A German citizen detained for five months in an Afghan prison was released in May last year on direct orders from Condoleezza Rice, then the national security adviser, after she learned the man had been mistakenly identified as a terrorist suspect, government officials said.

The officials said that when Khaled el-Masri was taken from a bus on the Macedonian-Serbian border in December 2003, US authorities believed he was a member of al-Qaeda who had trained at one of Osama bin Laden's camps in Afghanistan.

It took several months before they concluded he was the victim of mistaken identity, the officials said. His name was similar to an al-Qaeda suspect on an international watch list of possible terrorist operatives, they said.