U.S. forces on Thursday released five Iranian officials detained in January 2007 in northern Iraq on suspicion of aiding local Shiite militants, Iranian and Iraqi officials said.

Iranian embassy spokesman Amir Arshadi said the Iranian detainees had been handed over to Iraqi authorities prior to their transfer to the embassy. His comments were confirmed by Yassin Majid, media adviser to Iraqi Prime Minister Nouri al-Maliki.

The Iranians were detained in the northern Iraqi city of Irbil and at the time U.S. authorities said the men included the operations chief and other members of Iran's elite Quds Force, which is accused of arming and training Iraqi militants. Iran denied the claim.

Iranian Foreign Ministry spokesman Hasan Qashqavi confirmed the report on state television, saying "the hostages" were in al-Maliki's office for a meeting.

Qashqavi, who described the five men as "diplomats," said they called the Iranian embassy in Baghdad and their families in Iran to say they were doing well.

The Iranian television report identified the men as Mohsen Bagheri, Mahmoud Farhadi, Majid Ghaemi, Majid Dagheri and Abbas Jami.

Iraqi Foreign Minister Hoshyar Zebari told the Associated Press that the transfer, part of a U.S.-Iraq security pact to hand over Iraqi and foreign detainees, would help improve dialogue between the U.S. and Iran after a decades-long adversarial relationship.

"This is a good initiative by the Americans who are very clear in their call for dialogue with the Iranians," Zebari said. "This step was expected and we informed the Iranian side that these detainees would be released."

The U.S. military said only that the release and transfer of detainees to Iraqi authorities was a private matter that occurs regularly in line with a security agreement.

"We only talk process with regards to transfers and releases; we don't get into specifics about individual detainees; nor do we get into speculations beforehand," the military said in a statement.