A British-Australian academic serving a 10-year sentence in Iran for espionage has been freed, with Tehran saying it was a swap for three jailed Iranians.
In a statement, Kylie Moore-Gilbert thanked those who had worked for her release and said that leaving Iran was "bittersweet".
Dr Moore-Gilbert, a lecturer at Melbourne University, had been detained in Iran since September 2018.
She was tried in secret and strongly denied all the charges against her.
According to Iranian state media, she was exchanged for an Iranian businessman and two Iranian citizens "who had been detained abroad". They have not yet been named.
News of the exchange first came on Wednesday in a statement on the website of the Young Journalist Club, a news website affiliated to state television in Iran.
"An Iranian businessman and two Iranian citizens who were detained abroad on baseless charges were exchanged for a dual national spy named Kylie Moore-Gilbert, who worked for the Zionist regime," it said.
Video of the exchange was published by state broadcaster IRIB news and the Tasnim website.
Allow Twitter content?
The footage, which had no commentary, showed Dr Moore-Gilbert wearing a grey hijab and being driven away in a mini-van. Three men are seen being met by officials. One is in a wheelchair.
In a statement released hours later, Dr Moore-Gilbert thanked Australian officials who had worked "tirelessly" to secure her release.
"Thank you also to all of you who have supported me and campaigned for my freedom, it has meant the world to me to have you behind me throughout what has been a long and traumatic ordeal," she said.
"I have nothing but respect, love and admiration for the great nation of Iran and its warm-hearted, generous and brave people. It is with bittersweet feelings that I depart your country, despite the injustices which I have been subjected to. I came to Iran as a friend and with friendly intentions, and depart Iran with those sentiments not only still intact, but strengthened."
Australian Foreign Minister Marise Payne said she was "extremely pleased and relieved" at the release of Dr Moore-Gilbert which she said "was achieved through diplomatic engagement with the Iranian government". She made no reference to any exchange of prisoners.
"The Australian government has consistently rejected the grounds on which the Iranian government arrested, detained and convicted Dr Moore-Gilbert. We continue to do so," she said in a statement.
Senator Payne said Dr Moore-Gilbert would "soon be reunited with her family" but did not specify when she would be returning to Australia.
Dr Moore-Gilbert had been travelling on an Australian passport when she was detained at Tehran airport in 2018 as she tried to leave following a conference.
In letters smuggled out of Tehran's Evin prison earlier this year, the Cambridge-educated academic said she had "never been a spy" and feared for her mental health. She said she had rejected an offer from Iran to become a spy.
"I am not a spy. I have never been a spy, and I have no interest to work for a spying organisation in any country," she wrote.
Concerns for her wellbeing escalated in August when news emerged that she had been transferred to Qarchak, a notorious prison in the desert.
She was visited shortly afterwards by Australia's ambassador to Iran, Lyndall Sachs, who reported that she was "well".
Iran has detained a number of foreign nationals and Iranian dual citizens in recent years, many of them on spying charges. Human rights groups have accused Tehran of using the cases as leverage to try to gain concessions from other countries.
British-Iranian charity worker Nazanin Zaghari-Ratcliffe was jailed on spying charges in 2016. She has always maintained her innocence.
Her husband, Richard Ratcliffe, welcomed reports of Dr Moore-Gilbert's release.
"Nazanin and I are really happy for Kylie and her family," he told the BBC. "They have been through so much, borne with such dignity. And it is an early Christmas present for us all, that one more of us is out and on their way home, one more family can begin to heal."
Kate Allen, director of Amnesty International UK, said news of Dr Moore-Gilbert's release was "an enormous relief".
"There may now be renewed grounds for hoping that UK-Iranian dual-nationals like Nazanin Zaghari-Ratcliffe and Anoosheh Ashoori will also be released from their unjust jail terms in Iran in the coming days or weeks," she said.
Anoosheh Ashoori, a retired civil engineer from London, was jailed for 10 years in July 2019 after being convicted of spying for Israel's Mossad intelligence agency.