TEHRAN, Iran (CNN) -- The last British Embassy employee being held in Iran was freed on Sunday, his lawyer said.
Ahmadinejad supporters at the British Embassy last month accused the British of inciting election protests.
The lawyer, Abdul-Samad Khorramshahi, said Hossein Rassam was released and was with him, in good mental and physical condition. He said Rassam remains hopeful.
Khorramshahi earlier said Rassam would be released Sunday evening on payment of about $100,000 bail.
The arrest of British Embassy employees after disputed presidential elections last month was part of a sharp rift in relations between Tehran and London.
"I am very glad Hossein Rassam has been released," British Foreign Secretary David Miliband said in a written statement. "The release of all of our staff has remained an important priority throughout the past three weeks, and has required intensive discussions with the Iranian authorities."
Ten Iranians employed by the British Embassy were arrested June 27. Five were freed two days later, and another three were released two days after that. A ninth was let go on July 5, leaving only Rassam in custody.
The employees had been accused of helping to incite some of the post-election protests in the country, and had been threatened with trial.
Demonstrations broke out across the country when officials announced that the hardline incumbent, President Mahmoud Ahmadinejad, had won the June 12 election. Iranian security forces suppressed the protests, sometimes violently, and clamped down tightly on news reports from the country.
"[The] British Foreign Office had said last March that there may be riots during the elections in Iran and they said that they should warn their citizens to be careful," Ayatollah Ahmad Jannati, chairman of Iran's powerful Guardian Council said at Friday prayers on July 3, the Iranian Student's News Agency reported.
"What do these predictions mean? And then some people in the U.K. embassy, who had a hand in the disturbances, were arrested and will surely be put on trial."
Miliband then issued a statement "urgently seeking clarification from the appropriate Iranian authorities."
"We are confident that our staff have not engaged in any improper or illegal behavior," he said at the time.
Both the European Union and the United States supported London.
The European Union announced that all of its member governments would call in the Iranian ambassadors in their countries to tell them that the EU opposed the continued detention of the two British staffers.
A State Department official told CNN July 3 the United States "deplores the harassment of British Embassy staff and fully supports United Kingdom calls for their release."
Rassam is a political counselor at the embassy.
Miliband said in the Sunday statement he was "grateful to our European partners for their solidarity and support in resolving this issue. The detention of embassy staff was completely unjustified: I am confident that none of them were involved in any improper behavior."
Miliband said he remains deeply concerned by the detention of Clotilde Reiss, a French student arrested in Iran. "Europe is united in calling for her immediate release," he said.