A Canadian-Iranian retired professor was released from prison on "humanitarian grounds" and flown out of Iran on Monday, Iran's state-run news agency said, ending her months of detention alongside other dual nationals swept up by hard-liners in the security services.

Homa Hoodfar returned to Canada via Oman, a brief report on the state-run IRNA news agency said. Canadian Prime Minister Justin Trudeau hailed her release in a statement, thanking Italy, Switzerland and Oman for their help in the matter.

Hoodfar, 65, was questioned and barred from leaving Iran in March after traveling to the country to visit family following the death of her husband. Her family said she has been held in Tehran's Evin Prison since June. Hoodfar until recently taught anthropology and sociology at Montreal's Concordia University.

In July, Iran announced indictments for Hoodfar and three others, without providing any details about the accusations. In recent weeks, Hoodfar's supporters described her health as deteriorating while she was in solitary confinement, saying she was "barely able to walk or talk."

Hoodfar's supporters had pressed diplomats to discuss her case during the recent United Nations General Assembly in New York. Canadian Foreign Minister Stephane Dion met with Iranian Foreign Minister Mohammad Javad Zarif on the sidelines of the meeting Wednesday, state television reported.

Kaveh Ehsani, a friend of Hoodfar's in Chicago, said Monday that her supporters asked for "a period of crucial privacy before Homa and her family can address the media."

Canada has not had an embassy in Iran since 2012, when its then-Conservative-led government cut diplomatic ties over Tehran's contested nuclear program and other issues.

Trudeau said Canadians are "relieved that Dr. Hoodfar has been released from jail and will soon be reunited with her family, friends and colleagues."

"I would also like to recognize the cooperation of those Iranian authorities who facilitated her release and repatriation. They understand that cases like these impede more productive relations," he added.

Iran does not recognize dual nationalities, meaning those detained cannot receive consular assistance. In previous cases, dual nationals have faced secret charges in closed-door hearings in Iran's Revolutionary Court, which handles cases involving alleged attempts to overthrow the government.

Several dual nationals have been arrested in the year since world powers reached a nuclear deal with Iran to limit its uranium enrichment in exchange for the lifting of crippling economic sanctions.

Analysts have suggested Iranian hard-liners hope to use them as bargaining chips with the West. A prisoner swap in January between Iran and the U.S. that freed Washington Post reporter Jason Rezaian and three other Iranian-Americans in exchange for pardons or charges dropped against seven Iranians also saw the U.S. make a $400 million cash delivery to Iran.

While that money repaid a 1970s Iranian account to buy U.S. military equipment, it was contingent on the prisoner release. That's garnered criticism from Republicans in an election year.

Others with Western ties known to be recently detained in Iran include:

-- Siamak Namazi , an Iranian-American businessman who has advocated for closer ties between the two countries and whose father is also held in Tehran;

-- Baquer Namazi , a former Iranian and U.N. official in his 80s who is the father of Siamak;

-- Robin Shahini , an Iranian-American detained while visiting family who previously had made online comments criticizing Iran's human rights record;

-- Nazanin Zaghari-Ratcliffe , a British-Iranian woman sentenced to five years in prison on allegations of planning the "soft toppling" of Iran's government while traveling with her young daughter; and

-- Nizar Zakka , a U.S. permanent resident from Lebanon recently sentenced to 10 years in prison and a $4.2 million fine.

Still missing is former FBI agent Robert Levinson, who vanished in Iran in 2007 while on an unauthorized CIA mission.