As Australia sought Dr Moore-Gilbert's freedom from jail,Iranian government officials made it explicitly clear they wanted Saeed Moradi,Mohammad Khazaei and Masoud Sedaghat Zadeh released by Thai authorities in exchange.
The three men were all detained in Thailand on charges of having planned to bomb the capital,Bangkok,in 2012 that authorities said was intended to target Israeli diplomats.
Loading
The request from Iran led to the Australian government approaching the Thai government to seek help with arranging the prisoner swap. Thailand agreed to the deal after months of high-level negotiations. Discussions were also held with the Israeli government.
Under the terms of the agreement,all of the involved parties agreed not to publicise the arrangement because of its diplomatically sensitive nature.
But the Iranian regime soon broke that undertaking.
News of the exchange was first broken by Iran's Young Journalist Club,a news website affiliated to state television in Iran,which trumpeted the release of the three men who faced"baseless charges"and were"exchanged for a dual national spy named Kylie Moore-Gilbert,who worked for the Zionist regime".
Thai officials on Thursday confirmed they had approved the transfer back to Tehran of three Iranians who were involved in a botched 2012 bomb plot.
Chatchom Akapin,the deputy attorney-general,told The Associated Press that Thai authorities approved the transfer of the prisoners under an agreement between Thailand and Iran.
"These types of transfers aren't unusual. We transfer prisoners to other countries and at the same time receive Thais back under this type of agreement all the time,"he said.
Mr Morrison,who described Dr Moore-Gilbert's release as a"miracle"on breakfast television on Thursday morning,said negotiations to garner her release were not straightforward.
Senator Payne said the Australian government had always rejected the assertion Dr Moore-Gilbert was a spy.
"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,"Senator Payne said at a press conference on Thursday.
She also said Dr Moore-Gilbert would need to spend two weeks in quarantine upon her return to Australia.
"She will have to go through the quarantine process,but she won't be doing that alone,we will make sure she is well supported and is able to just adjust after so long in detention to life back in Australia and to reuniting with her family in Australia in due course,"Senator Payne told 2GB.
She added that she had spoken with Dr Moore-Gilbert in the early hours of Thursday morning and the Australian woman had been"remarkably positive".
"[She was a] very pleased young Australian woman,so relieved at leaving that detention facility and returning to Australia."
The prisoner swap deal has heightened concerns about Iran's"hostage diplomacy",with human rights groups fearing it will only encourage the regime to wrongly imprison other individuals in the future.
Elaine Pearson,Australian director of Human Rights Watch,welcomed the news of Dr Moore-Gilbert's release but criticised Iran's"deplorable use of hostage diplomacy".
"There is a clear pattern by Iran's government to arbitrarily detain foreign and dual nationals to use them in bargaining chips in negotiations with other states,"she said.
Colin Rubenstein,executive director of the Australia Israel and Jewish Affairs Council,said:"Holding people hostage in exchange for terrorists is typical of the tyrannical Iranian regime.
"Unlike Dr Moore-Gilbert,who has never posed a danger to anyone,now that these men are free they will again present a threat of terrorist violence to innocent people,"he said.
Liberal MP and former senior diplomat Dave Sharma said he was"tremendously relieved by news of Dr Moore-Gilbert's release,after what can only be described as a nightmare ordeal for her and her family".
"The Prime Minister,the Foreign Minister and the many government officials who worked on this case,quietly,tirelessly and resolutely over many months,deserve our gratitude and thanks,"Mr Sharma said.
Both Dr Moore-Gilbert and her family asked the media to respect her and her family's privacy,asking for space to"re-adjust and re-acclimate after such a traumatic experience".
Start your day informed
Our Morning Edition newsletter is a curated guide to the most important and interesting stories,analysis and insights. Sign up toThe Sydney Morning Herald’s newsletterhere,The Age’shere,Brisbane Times’here,andWAtoday’shere.