Qatar paid up to $1bn to release members of the Gulf state's royal family who were kidnapped in Iraq while on a hunting trip, according to people involved in the hostage deal — one of the triggers behind Gulf states' dramatic decision to cut ties with Doha.
Commanders of militant groups and government officials in the region told the Financial Times that Doha spent the money in a transaction that secured the release of 26 members of a Qatari falconry party in southern Iraq and about 50 militants captured by jihadis in Syria. By their telling, Qatar paid off two of the most frequently blacklisted forces of the Middle East in one fell swoop: an al-Qaeda affiliate fighting in Syria and Iranian security officials.
The deal, which was concluded in April, heightened concerns among Qatar's neighbours about the small gas-rich state's role in a region plagued by conflict and bitter rivalries. And on Monday, Saudi Arabia, Egypt, the United Arab Emirates and Bahrain took the extraordinary step of cutting off diplomatic ties and transport links to Qatar, alleging the country fuels extremism and terrorism.
"The ransom payments are the straw that broke the camel's back," said one Gulf observer.
Doha denies it backs terrorist groups and dismissed the blockade by its neighbours as "founded on allegations that have no basis in fact". It said it could not immediately respond to a request for comment on the hostage deal. But a person close to the Qatari government acknowledged that "payments" were made. The person was unaware of the amounts or where the money went.
Qatar, a US ally that hosts an American military base, has long drawn the ire of its neighbours, who consider Doha an irritating regional maverick. The world's top exporter of liquefied natural gas, it has used its immense wealth to court relations from London to Washington and Tokyo.
But critics accuse it of seeking to punch above its weight diplomatically, meddling in regional affairs and using the Arabic channel of Al Jazeera, the satellite television network it set up, as a propaganda tool.
Doha has a history of reaching out to all kinds of controversial groups, from rebels in Sudan's Darfur region to the Taliban in Afghanistan and Hamas in Gaza. Qatar touts itself as a neutral player that can act as an intermediary in regional conflicts. But its critics, notably Saudi Arabia and the UAE, allege it also uses such interventions to play both sides and fund radical Islamist groups, most recently in Libya and Syria. And to Doha's critics, the hostage deal was further evidence of that role.
"If you want to know how Qatar funds jihadis, look no further than the hostage deal," said a Syrian opposition figure who has worked with an al-Qaeda mediator on hostage swaps in Syria. "And this isn't the first — it is one of a series since the beginning of the war."
The FT spoke to people involved on both sides of the hostage swap deal, including two government officials in the region, three Iraqi Shia militia leaders and two Syrian opposition figures.
Around $700m was paid both to Iranian figures and the regional Shia militias they support, according to regional government officials. They added that $200m to $300m went to Islamist groups in Syria, most of that to Tahrir al-Sham, a group with links to al-Qaeda.
Those who spoke to the FT said the deal highlighted how Qatar has allegedly used hostage payments to bankroll jihadis in Syria. But to its Gulf neighbours, the biggest issue is likely to be the fact that Doha could have paid off their main regional rival, Iran, which they accuse of fuelling conflicts in the Arab world.
This particular saga began when an Iranian-backed Iraqi Shia militia, known as Kata'eb Hizbollah, kidnapped the Qataris in December 2015. Three Iraqi militia leaders say the hostages were held in Iran.
Kata'eb Hizbollah is an Iraqi group but it is seen as having links with Iran's main regional proxy, Hizbollah, the Lebanese militant group. The latter is helping Iran back Bashar al-Assad, the Syrian president, in his country's six-year conflict.
Two regional diplomats said they believed one of the Iraqi group's motives for the kidnapping was to give Hizbollah and Iran leverage to negotiate the release of Shia fighters kidnapped by the radical Sunni group Tahrir al-Sham in Syria.
Tahrir al-Sham, in previous iterations, was an al-Qaeda branch. It claims it has broken the connection, but the international community still views it as an affiliate.
The hostage transaction was also linked to a separate agreement to facilitate the evacuation of four towns in Syria — two surrounded by jihadi forces and two besieged by Shia militias — say Syrian rebels and diplomats.
One western diplomat said the arrangement provided Qatar the "cover" to finance the hostage deal. "Iran and Qatar had long been looking for a cover to do this [hostage] deal, and they finally found it," he said.
According to two opposition figures with close contact with the groups paid, Qatar used the evacuation arrangement to pay $120-$140m to Tahrir al-Sham. Another $80m, they said, went to the Islamist group Ahrar al-Sham.
"The Qataris pay anyone and everyone, to what end? They have only brought about our ruin," said a Syrian rebel commander, who gave details about the payments but asked not to be identified.
A regional Arab official said the total paid to jihadi groups was closer to $300m.
"So, if you add that up to the other $700m they paid to Iran and its proxies, that means Qatar actually spent about a billion dollars on this crazy deal," he said.
The Iraqi Shia militia commanders in Iraq, all from hardline Iranian-backed groups, said that, to their knowledge, Iran had obtained around $400m after giving them a payment they would not disclose. They agreed to share some details because they were unhappy about their share of the payment.
"They [the Iranians] took the lion's share," said a member of one of the Iranian-backed Shia militias in Iraq. "That's caused some of us to be frustrated, because that was not the deal."
Another confusing chapter of the deal is that Haidar al-Abadi, Iraqi prime minister, said in April his government had seized hundreds of millions of dollars, which Iraqi officials said arrived on Qatari planes "illegally". It is not clear if this is money is part of the sums mentioned above, or an additional amount.
"The money all came in suitcases, can you imagine this?" said one senior official.
Additional reporting by Simeon Kerr in Dubai
Watch: Why Saudi Arabia is mad at Qatar