BAGHDAD - A British contractor was freed yesterday and in good health more than two years after he was abducted, apparently the only survivor of a group of five Britons abducted in a bold raid outside Iraq's Finance Ministry in 2007.

His release came as a bombing in the country's western Anbar province killed 23 people and narrowly missed the province's governor. The high-profile attack in what used to be a stronghold of the insurgency was a sign of the tenuousness of the security in Iraq.

Computer consultant Peter Moore, who was handed over to Iraqi authorities yesterday, was abducted in May 2007 with his four British bodyguards. All the bodyguards are believed dead.

Foreign Secretary David Miliband said that Moore, 36, was in good health at the British Embassy in Baghdad and would soon return to Britain. He said that no concessions had been made to the hostage-takers and that Moore's release was the result of the reconciliation process between Iraq's government and armed groups willing to renounce violence.

Moore's release coincided with the transfer of the head of the extremist group behind the kidnapping, Asaib Ahl al-Haq, or League of the Righteous, from U.S. to Iraqi custody.

Qais al-Khazali and his brother were accused of organizing an attack on a local government headquarters in the city of Karbala that killed five U.S. soldiers on Jan. 20, 2007.

Moore's kidnappers had demanded his release along with that of several Shiite militiamen held by U.S. forces. The extremist group in August promised to lay down its weapons and join the political process, which had raised hopes for Moore's release.

In London, a spokeswoman for Britain's Foreign Office said that U.S. forces transferred Khazali to Iraqi custody yesterday but denied any connection with Moore. She spoke on condition of anonymity.

In Baghdad, a representative of Khazali's group and an Iraqi member of the negotiating team that helped secure Moore's release said that Khazali was transferred, but they said it took place about a week ago.

Neither would say explicitly that there was a deal, but they added that the extremist group did not release Moore until it confirmed the transfer.

In Washington, a senior U.S. defense official said Khazali was released yesterday under an arrest warrant for further detention and was one of 1,522 prisoners handed over to Iraq by the United States this year as part of reconciliation efforts.

The officials in Iraq and Washington all spoke on condition of anonymity.

Moore's release came as twin attacks in Anbar province narrowly missed the region's governor, killing 23 people and raising concerns about the insurgency's continued ability to wage high-profile attacks.

Two bombs exploded in Anbar's capital of Ramadi, 70 miles west of Baghdad, said Police Lt. Col. Imad al-Fahdawi. First, a car driven by a suicide bomber blew up near a checkpoint on the main road near the provincial administration buildings.

Then, as Gov. Qassim al-Fahdawi went out to look at what had happened, a second bomber with an explosives belt strapped to his body pushed through the crowd and blew himself up.