By Alex Stevenson
The last of nine staff at the British embassy in Iran was released yesterday, the government has confirmed.
Hossein Rassam had been held by Iranian authorities for three weeks on suspicion that Britain was deliberately stoking up unrest in the wake of the recent disputed presidential election.
Eight others had been arrested but these were all released within a week following expressions of diplomatic solidarity from European Union states.
Iran's Guardian Council, a senior body of jurists and theologians appointed by the country's Supreme Leader, had threatened a trial could have taken place.
But this danger now appears to have abated.
Foreign secretary David Miliband said "intensive discussions" with the Iranian government had resulted in eventual success.
"I am grateful to our European partners for their solidarity and support in resolving this issue," he said.
"The detention of Embassy staff was completely unjustified: I am confident that none of them were involved in any improper behaviour."
Mr Miliband said he remained "deeply concerned" about the detention of a French student arrested in Iran, Clotilde Reiss.
The politics student took photographs at a demonstration last month and now faces accusation of spying by Tehran. French president Nicolas Sarkozy has dismissed the allegations as "pure fantasy".