An Australian-British academic jailed for spying by Iran has been released after two "traumatic" years behind bars, in a swap for three Iranians linked to a botched Bangkok bomb plot.

Middle East scholar Kylie Moore-Gilbert said that departing Iran was "bittersweet" despite "injustices" endured during more than 800 days detained in the country's toughest prisons.

"I came to Iran as a friend and with friendly intentions," she said, praising the "warm-hearted, generous and brave" Iranian people, despite what she called a "long and traumatic ordeal".

The 33-year-old was arrested by Iran's hardline Islamic Revolutionary Guard Corps in 2018, after attending an academic conference in the holy city of Qom in central Iran.

She was later charged with espionage and sentenced to ten years in jail.

Her release was secured as part of a prisoner swap for three men: Masoud Sedaghatzadeh, Mohammad Khazaei and Saeid Moradi, who were all linked to a failed plot to assassinate Israeli diplomats in Thailand in 2012.

Thai corrections authorities have confirmed that Sedaghatzadeh and Moradi were transferred back to Iran as prisoners, while Khazaei was granted a royal pardon in August.

The first images of a freed Dr Moore-Gilbert emerged on Iranian state television late yesterday, sparking elation from friends and family who had campaigned for her freedom and maintain her innocence.

"We are relieved and ecstatic," the family said in a statement. "We cannot convey the overwhelming happiness that each of us feel at this incredible news." 

In footage broadcast by Iran's Irib news agency from Tehran airport, Dr Moore-Gilbert was seen wearing a headscarf and a face mask, accompanied by the Australian ambassador. 

Seemingly aware of the camera, she removed the mask to confirm her identity.

Irib also showed footage of three men draped in Iranian flags and being greeted as heroes by officials, including the deputy foreign minister.

Australian Prime Minister Scott Morrison said he had spoken to Dr Moore-Gilbert and confirmed she would receive health and psychological support on her return to Australia, which has been complicated by Covid-19 restrictions and 14-day mandatory quarantine.

"She is an amazing Australian who has gone through an ordeal that we can only imagine and it will be a tough transition for her," he said at a virtual press conference.

The University of Melbourne Islamic studies lecturer herself said in a statement she faced a "challenging period of adjustment" at home in Australia.

Letters smuggled out of prison told of Dr Moore-Gilbert's deep psychological and legal struggles.

She wrote that the first 10 months she spent in a wing of Tehran's notorious Evin prison had "gravely damaged" her mental health.

"I am still denied phone calls and visitations, and I am afraid that my mental and emotional state may further deteriorate if I remain in this extremely restrictive detention ward," she said.

She also recounted rejecting Tehran's offer to work as 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 said she had been shown two different draft decisions to her appeal - one for a 13-month sentence, another confirming the original sentence of 10 years.

She was eventually transferred to the general women's section of Evin prison, where British-Iranian woman Nazanin Zaghari-Ratcliffe was held until being granted temporary leave because of the coronavirus outbreak.

Ms Zaghari-Ratcliffe's husband said she was "really happy" when he told her about Dr Moore-Gilbert's release.

Throughout Dr Moore-Gilbert's internment, friends and family had become increasingly critical of Australia's diplomatic approach.

Australian foreign minister Marise Payne said the release followed "determined work" and described the case as "complex and sensitive".

The US State Department welcomed Dr Moore-Gilbert's release but said "she should never have been imprisoned", accusing Iran of "hostage diplomacy".

British foreign secretary Dominic Raab, in a tweet, called on Iran to "release all the remaining British dual nationals" detained in the country.

Iran, which has tense relations with the West, has over the years arrested several foreign nationals, often on accusations of spying.