The release of the British hostage Peter Moore finally came – as expected – in return for the "freeing" of Qais al-Khazali. The saga has dragged on for so long because the Americans were reluctant to free the militant Shia leader they blame for an attack on their base in Kerbala in 2007 in which five US soldiers were killed.
The kidnapping of Mr Moore and four British security guards differed from most of the thousands of abductions in Iraq. Most are for money. Some are to make a political point by seizing and possibly killing a foreigner. But the kidnapping of Mr Moore's group at the Iraqi finance ministry in Baghdad that May was precisely targeted. The goal was to secure a hostage whose release could be used as a bargaining chip to free the leaders of the militant Iranian-backed Shia group Asaib ahl al-Haq, the League of Righteousness.
An exchange of prisoners was always going to be difficult to arrange. The Americans and the Iranians were engaged in covert tit-for-tat hostilities in which Iranian diplomats and officials were seized. This reached a peak in the first half of 2007 when British sailors were taken prisoner by Iranian Revolutionary Guards in disputed waters in the Gulf. Five Iranian officials were abducted in an American helicopter raid on the Kurdish capital Arbil. These have also been freed.
The Kerbala attack in which the US troops died appears to have been a carefully organised assault based on extensive intelligence in order to secure US hostages – although in the event the US prisoners were killed. Qais al-Khazali, his brother Laith and a Lebanese Hizbollah official were later seized in Basra and a 22-page document packed with information on the Kerbala base was found with them.
The League of Righteousness was a break-away group from the radical Shia party which follows the militant Shia cleric Muqtada al-Sadr. Qais al-Khazali, a geologist by training, had once been his spokesman during the Shia Mehdi Army's battles against US troops for control of Najaf in 2004.
After Sadr declared a ceasefire, the League of Righteousness and other Iranian-backed groups split from him and went on making attacks on US forces. They were said to be well paid by Iran and also to have received modern weapons.
An exchange of prisoners only became feasible when the League of Righteousness declared its readiness for a ceasefire and the Americans were due, in any case, to hand over all Iraqi prisoners to the Iraqi government under the terms of a Status of Forces Agreement.
Why did the kidnappers kill the three, and probably four, of the British security men taken with Mr Moore? The Independent was told by Sadrist leaders in Baghdad that this was because the captors from the League of Righteousness had heard that their members in captivity were being tortured and one had been killed. So they killed the Britons in retaliation. Mr Moore was treated differently and may at one stage have been held inside Iran. His release is also part of a general stand down of the Shia militia groups in return for a switch to constitutional politics and a release of their prisoners.
The impending departure of US forces was one of their main demands and also one of the reasons that Iran wanted to retain a military option within Iraq. In a government dominated by the Shia it has always been easier for Shia militants to return to civilian life than it has been for their Sunni equivalents.
For its part the Iraqi government wants to show that Iraq has changed since the days two-and-a-half years ago when kidnappings, like that of Mr Moore, did not surprise anybody.