Iranian-Canadian anthropologist Homa Hoodfar who was arrested and jailed in Tehran in June for "security offences" has been released and has left the country, the foreign ministry said on Monday.
The official IRNA news agency quoted a ministry spokesman as saying that the 65-year-old with dual nationality, who had also been accused of "feminist activities", was freed "for humanitarian reasons".
Hoodfar travelled to Oman and on to Canada, he said.
Iranian state television has said Hoodfar was a founding member of a London-based advocacy group, Women Living Under Muslim Law (WLUML).
Canada's Prime Minister Justin Trudeau said in a statement that Canadians were relieved that Hoodfar had been released and would "soon be reunited with her family, friends and colleagues".
"The government of Canada has been actively and constructively engaged at the highest levels... since her ordeal began," he said.
"In the absence of diplomatic representation of its own in Iran, Canada worked closely with others who were instrumental in helping secure Dr Hoodfar's release -- most notably Oman, Italy and Switzerland."
"I would also like to recognize the cooperation of those Iranian authorities who facilitated her release and repatriation," Trudeau said.
"They understand that cases like these impede more productive relations."