Sixteen months ago, gunmen in southern Iraq abducted 26 Qatari hunters. Last Friday, civilians in four towns in northern and southern Syria, and the wider region, paid the price for the release of the hostages.

The hunters were released as part of a deal brokered by Qatar and Iran. The process involved two negotiation routes, one between the Iraqi militia and Doha and the other between Shia and Sunni extremists in northern and southern Syria. Details about the agreement, relayed to the author, highlight the deeply problematic nature of the role played by regional countries to secure a deal that only adds fuel to the fire.

The negotiations about the four Syrian towns – namely Al-Foua and Kefraya, in Idlib, and Madhaya and Zabadani, south of Damascus – built on a 2015 ceasefire agreement reached between Iran and local Syrian militias in six towns that included the four ones in which a new deal was reached last week.

In 2015, Hizbollah had waged a three-month offensive to recapture Zabadani, a town near the Lebanese border. After the failure of the offensive, which was part of an effort to clear all the Qalamoun region near Lebanon, broader negotiations began in the southern and northern towns between Hizbollah and the jihadist-led Jaish Al Fateh, under the auspices of Iran and Qatar. According to the old agreement, the regime would not fly helicopters or warplanes in certain areas controlled by Jaish Al Fateh, a defunct alliance of jihadist and Islamist groups, including to drop aid and ammunition to fighters on the ground.

The old deal also stipulated that neither side could set up new bases or trenches on the immediate front-lines, which would effectively create buffers between the two warring sides. Enforcing a humanitarian or logistical blockade outside those towns was also prohibited. Sources with Jabhat Al Nusra, which later became Hayat Tahrir Al Sham (HTS), praised the deal at the time as favourable to the jihadist-led alliance.

The new agreement upholds the banning of aerial bombardment and clashes in those towns as part of a ceasefire for nine months. It also allows humanitarian access to these towns. The regime is required to release 1,500 prisoners, mostly women. These are the positive parts

The deal also stipulates a demographic shift. Three-thousand rebel fighters along with their families are required to leave Zabadani with light weapons to a destination of their choice. A similar number of regime soldiers and 5,000 civilians are allowed to evacuate Foua and Kafraya, although families have the right to remain in their towns if they wish to do so. In the rebel-held town of Madhaya, civilians who wish to remain are reassured they will not be subject to arbitrary arrest or collective punishment. After an outcry from the Syrian opposition against the deal, HTS defended it as favourable to the opposition and achieving more than the opposition could through the Geneva and Astana processes.

The other route involved negotiations between Qatar and Kata’ib Hizbollah, a Shia militia in Iraq, which abducted the Qatari and Saudi hunters on December 16, 2015, in southern Iraq near the Saudi border.

The deal involved the payment of a handsome amount of cash to the parties involved in the negotiations, including the HTS, the Al Qaeda offshoot in Syria, Ahrar Al Sham, a Syrian group operating mostly in the north, and Kata’ib Hizbollah. Hamed Al Mutlaq, member of the Iraqi parliament’s defence and security committee, was quoted by Arabi21 as saying that Iraqi authorities seized money estimated to be in the hundreds of millions of dollars in Baghdad International Airport. He said the money was presumably to seal the deal.

The overall deal has several problematic aspects. It shows the power Iran wields in three countries, Lebanon and Syria through Hizbollah and Iraq through militias beholden to it.

In Syria, it makes sense for Iran and Hizbollah to decide the terms of the deal due to Hizbollah’s lead role in the fighting in those towns, especially those near the Lebanese border. In Iraq, however, there is no question that the deal denigrates the government in Baghdad. A militia beholden to Iran kidnapped hunters, who held government-issued permits, and Baghdad could do nothing about it but Tehran could. According to a senior official briefed on the broader deal, Haider Al Abadi, the Iraqi prime minister, was disturbed by the hefty ransom payment to Kata’ib Hizbollah. Former Iraqi foreign minister, Hoshyar Zebari, also wrote on Twitter: “Release of Qatari hunters in Iraq after 16 months in captivity by a pro-Iranian & Hizbollah Shia armed group is a travesty of sovereign Iraq.”

In Syria, the payment comes at a time when financial support to the moderate rebels through the United States-managed operation centres is suspended. Turkey even banned several humanitarian relief organisations from operating inside Syria, including Mercy Corps, which used to deliver urgent and critical assistance to 350,000 to 500,000 civilians each month.

The deal empowers extremists from both Sunni and Shia sides, fuels conflicts and strengthens Iran’s hands in the region. The episode sums up the current direction in three major Arab countries, where Iran and extremist militias increasingly call the shots. It is not just a travesty of Iraqi sovereignty. It is also a travesty of the US-led campaign to fight extremism in the region.

Hassan Hassan is a senior fellow at the Tahrir Institute for Middle East Policy and co-author of ISIS: Inside the Army of Terror.

On Twitter: @hxhassan