Benjamin Brière and Bernard Phelan had been accused of spying, which they denied. They had protested their captivity with hunger strikes, and their families had fought for their release.
Two French citizens detained by Iran were released on Friday on humanitarian grounds and were on their way back to France, according to French and Iranian authorities.
One of the men, Benjamin Brière, a 38-year-old French tourist, had been held for three years. The other, Bernard Phelan, a 64-year-old French-Irish travel consultant, was arrested in October 2022.
President Emmanuel Macron of France called their return “a relief.”
“Free, finally,” Mr. Macron said on Twitter, adding that France would “continue to work for the return of our compatriots still detained in Iran.”
Mr. Brière and Mr. Phelan had been accused of spying on Iran and acting against its security interests, charges that the two men and French authorities strenuously denied. The men had gone on intermittent hunger strikes to protest their detention, weakening them and worrying their families, who had urged repeatedly for their release.
Catherine Colonna, the French foreign minister, said in a statement on Friday that Mr. Brière and Mr. Phelan had left the prison in Mashhad, a city in northeastern Iran, where they were kept.
“They were provided with medical care immediately after their release,” she said. “I am delighted that they will soon be able to reunite with their relatives in Paris.”
Ms. Colonna said that in a phone conversation with her Iranian counterpart, Hossein Amir Abdollahian, she had “reiterated France’s determination that the other French citizens still detained in Iran should also regain their full freedom quickly and enjoy their right to consular protection.”
Four French citizens are still in Iranian custody, according to French authorities. A fifth person, Fariba Adelkhah — an academic who holds an Iranian passport as well as a French one — was arrested in 2019 and sentenced to five years in prison; she was released in February but has not yet been able to leave Iran.
Iran has detained several foreigners and dual citizens since 2018, when President Donald J. Trump withdrew the United States from a nuclear deal with the country and reimposed sanctions.
Western and European countries have accused Iran of using detained people as diplomatic bargaining chips or to press for the release of Iranian prisoners abroad.
In 2020, for instance, the French government secured the release of an academic who had been held on national security charges, as part of a prisoner swap.
It was not immediately clear whether the release of Mr. Brière and Mr. Phelan had been secured by a similar deal. On Friday, French, Irish and Iranian authorities made no mention of one.
IRNA, Iran’s state-run news service, said that the two men were released on “humanitarian” grounds, while Iran’s embassies in Paris and Dublin said on Twitter that it was a “humanitarian” and “friendly” gesture.
Saeid Dehghan, one of the four Iranian lawyers for Mr. Brière, said that he had become “extremely weak and frail” because of his hunger strike.
“If the release wouldn’t have happened by now, Benjamin would be at a major life risk,” Mr. Dehghan said.
Mr. Phelan, Irish-born but based in Paris, was in Iran consulting for a tour operator when he was arrested during a wave of antigovernment protests and accused of disseminating anti-regime propaganda and taking pictures of security services, according to his family. Mr. Phelan, who according to his family has hypertensive heart disease and chronic bone and eyesight issues, was sentenced to six and a half years in prison in March.
Caroline Massé-Phelan, Mr. Phelan’s sister, told Agence France-Presse in January that he was “an innocent man” who “loved Iran, who is 64 years old, who is sick, who just wants to go home.”
Micheál Martin, Ireland’s minister for foreign affairs and minister of defense, said in a statement on Friday that “the last seven months have been a very difficult ordeal for Bernard and for his family.”
“Many people have worked tirelessly for this outcome over many months,” he added.
Mr. Brière was arrested in May 2020 in northeastern Iran and accused of taking photographs in a prohibited area with a drone, leading to charges of espionage, which is punishable by death. He was also facing a propaganda charge because he had asked in a social media post why head scarves were required for women in Iran but optional in some other predominantly Muslim countries.
Mr. Brière was sentenced to eight years in prison but was then acquitted in February by an appeals court, though he was not released from prison at the time.
“After almost 1,000 days of harrowing captivity, Benjamin Brière is finally free,” Philippe Valent, Mr. Brière’s lawyer in France, said in a statement. “Benjamin’s family and countless supporters are waiting for his imminent arrival on the national territory, in order to allow him to physically and mentally recover.”
Leily Nikounazar contributed reporting.