It is clear now that from the very start, the hunters’ abduction was linked to the civil war in Syria, which has drawn in regional powers in an increasingly complicated proxy war. On one side of the hostage negotiations were Shiite powers — Iran and its Lebanese proxy Hezbollah — which firmly support the Syrian government of Bashar al-Assad. On the other were the Sunni powers Qatar and Turkey, which fund and arm rebel groups trying to take down Mr. Assad’s government.
Their release, which involved the payment of millions of dollars in ransom to an Iraqi militia backed by Iran, was tied to a broader deal involving a trading of besieged sectarian populations among four towns in Syria, according to a senior Shiite leader in Iraq who spoke on the condition of anonymity because of the sensitivity of the subject.
The Iraqi Shiite official said the release of the Qatari prisoners was linked to the safe evacuation — and delivery of humanitarian aid — of residents of two Shiite villages in Idlib Province, Fouaa and Kfarya, that have been under government control but besieged by Sunni Islamist rebel groups backed by Turkey and Qatar.
As part of the Syrian deal, which was negotiated separately before the fate of the hostages became entwined with the talks, residents of two predominantly Sunni villages, Madaya and Zabadani, that have been held by rebels but besieged by forces loyal to the Syrian government, including Hezbollah, are to be bused to safety. Many of them, about 2,000 people, have already been evacuated from Madaya.
Last week, as the evacuation of the Shiite villages was underway, dozens of people were killed when buses of evacuees were hit by a powerful car bomb. The attack stalled the transfer of the civilians and delayed the release of the Qatari hostages. On Friday, the transfers, which critics have said amount to sectarian cleansing and will result in permanent demographic shifts in Syria, resumed, according to The Associated Press.
The Qataris, according to another senior Iraqi official, paid millions of dollars to Kita’ib Hezbollah, an Iraqi Shiite militia controlled by Iran that had abducted the hostages.
Earlier in the week, Iraq’s prime minister, Haider al-Abadi, was asked at a news conference about the fate of the hunters. Mr. Abadi is thought to have played only a minimal role, if any, in the negotiations — a reflection of the power that Iran wields in Iraq through the numerous militias it supports.
His response was that the episode was a national disgrace, a comment that many interpreted as a veiled criticism of Iran.
“The Qatari hunters entered Iraq’s territory in an official way, and they were granted visas,” he said. “They should have been directly protected by the Ministry of Interior, but unfortunately, they were abducted.”
He said the kidnappings were “an insult to Iraq and its people.”
Iran’s militias have a long history of kidnapping in Iraq, especially of Americans after the 2003 invasion.
The kidnapping of the hunters, in December 2015, came around the time of two other abductions involving citizens of Turkey and the United States.
Earlier in 2015, 17 Turkish workers were roused from their sleep at a construction site by masked gunmen and taken away. A month later, they were released unharmed. Three Americans were taken in January 2016 from an apartment in Baghdad. They were later freed after negotiations involving the Iraqi intelligence service in which Moktada al-Sadr, an influential Shiite cleric, helped secure their release.
The Qatari hunters were captured in southern Iraq, largely considered a safe place unmarred by the violence that has engulfed the country’s north, where the Islamic State seized cities in 2014 and where it is fighting now to hold on to the city of Mosul in the face of an offensive by government forces.
The desert has also been a popular place for wealthy Arabs like the Qataris to hunt for falcons. At the time of the abductions, the local governor described a sophisticated, militarylike operation in which the kidnappers arrived in dozens of S.U.V.s with mounted machine guns and stormed a cluster of tents set up by the Qataris.