A British computer programmer seized in Iraq was held in Iran for at least part of his captivity, the U.S. general who oversees the wars in Iraq and Afghanistan said on Friday.

Gen. David Petraeus said, however, that it was difficult to tell whether Iran's elite Revolutionary Guard or the Quds force _ an arm of the Guard involved in foreign operations _ had a role in Peter Moore's capture.

U.S. officials have accused Iran of funneling money and arms to Shiite militias in Iraq through the Quds force and of seeking to exert a negative influence over the neighboring country and its Shiite-dominated government.

The assertion that Moore, who was taken by a Shiite extremist group in Iraq, had been moved to Iran at some stage pointed to the possibility of continued Iranian involvement in its neighbor's affairs. Petraeus warned Friday that Iranian-backed militias still to pose a threat to Iraq's stability.

"It is difficult to say what role the Revolutionary Guards Corps and in particular the Quds force element played in that. I am on the record as having said that our intelligence assessment is that he certainly spent at least part of the time in Iran, part of the time that he was a hostage," Petraeus said.

Moore was freed Wednesday after spending more than two years in captivity. He and four of his bodyguards were kidnapped in a brazen daytime attack in front of the Finance Ministry in Baghdad in 2007. The bodies of three of his companions have been returned and a fourth is believed to be dead.

He returned to Britain Friday, the British government said.

Around the same time Moore was freed, the U.S. military transferred a militant whose group was involved in the abduction over to Iraqi custody.

Petraeus said Qais al-Khazali was handed over in accordance with an agreement with the Iraqi government to transfer detainees in American custody or release them.

Al-Khazali, leader of Shiite extremist group Asaib Ahl al-Haq, was held in U.S. custody over accusations he aided an attack in the southern city of Karbala that left five U.S. soldiers dead in 2007.

The militant group had been pushing for al-Khazali's release along with the release of other militants in U.S. custody. U.S. and British authorities have said there was no deal to trade al-Khazali for Moore, although the timing of al-Khazali's transfer from U.S. to Iraqi custody _ said by the British government to have happened the same day Moore was released _ has raised questions.

A representative of al-Khazali's group and an Iraqi member of the negotiating team that helped secure Moore's release told The Associated Press that the militant group did not release Moore until it got confirmation its leader was transferred.