HINGHAM — Amelia Newcomb got a call at 4:52 a.m. Saturday that filled her with relief. On the other end was her 30-year-old son, Matthew Trevithick, who told her the Iranian government had released him from prison and he would soon be heading home.
Trevithick was one of five Americans released by the Iranian government. The Boston University graduate was released separately from four Iranian-Americans, including a Washington Post journalist, who were also freed as part of a prisoner exchange.
"We were thrilled to hear his voice," Newcomb said at her home in Hingham on Saturday.
Trevithick, who was studying language in Iran, spent 40 days in Evin Prison in Tehran, the family said. It is unclear why he was arrested or whether he was charged with a crime.
"We are profoundly grateful to all those who worked for his release and are happy for all the families whose loved ones are also heading home," the family said in the statement.
Before he was arrested, Trevithick had cofounded the Turkey-based SREO, a nonpartisan research center that analyzed the humanitarian crisis in that region, his family's statement said.
In September, he took a leave of absence from that organization to study Farsi at the Dehkhoda Institute, a language center affiliated with Tehran University.
Trevithick graduated from BU in 2008 with a degree in international relations. Within a year, he had moved to northern Iraq, where he started a job as an assistant to the provost at the American University of Iraq, Sulaimani, according to an 2013 article about him in BU's Bostonia magazine.
"We're very pleased. It's a good day," said college spokesman Colin Riley.
An avid rower, Trevithick brought his rowing machine with him when he moved to Iraq. The 2008 Head of the Charles silver medalist worked to start an Afghan national rowing team and also coached in Iraq, according to his biography on the United States Institute of Peace website, which a family member confirmed.
Trevithick had also worked as a librarian at American University of Iraq, where he collected books and worked to establish a library for the school, according to a 2009 article in The Patriot Ledger.
In addition to editing an autobiography of Afghanistan's first minister of higher education after the fall of the Taliban, Trevithick wrote for The Atlantic, The Wall Street Journal, and The Christian Science Monitor, where Newcomb is international news editor.
New Yorker magazine writer Robin Wright Saturday said Trevithick was her research assistant in 2009 at the Woodrow Wilson International Center, in Washington, D.C., where she is a fellow.
The pair stayed in close touch and in 2014 traveled to Syria together, Wright said in a brief phone interview with the Globe. She said she was in contact with Trevithick just a few days before he was picked up in Tehran.
"This is a guy who's very brave, very interested in understanding foreign cultures, particularly in that part of the world," Wright said.
Until his detainment, Trevithick was active on social media and frequently retweeted articles about the Middle East and to promote his podcast, Sources and Methods, where he most recently hosted a couple who made an app for tracking physical exercise.
His most recent tweet was on Nov. 13, when he retweeted a message from Barham Salih, the former prime minister of Kurdistan.
During his travels, Trevithick plunged into societies that differed intensely from his South Shore hometown, and developed a deep understanding of those foreign cultures.
In a column for the Hingham Journal in 2010, he reflected on his life in the city of Sulaymaniyah, after having finished a tour of a center where Saddam Hussein had tortured prisoners.
"There is a cautious optimism in the air in northern Iraq," he wrote. "By most indications, the future looks bright. But that's all been heard before: history shows us that the Middle East is a place where despair can be snatched from the jaws of hope all too easily."
In a call with reporters Saturday night, a senior White House official said it was a coincidence that the prisoners' release happened on the same day that the nuclear deal was implemented.
"We did not link the two issues," he said. "What the nuclear deal did do, was give us much greater access to Iran officials. It was our judgment, after we reached the nuclear deal, that we had the opportunity to say to the Iranian [government] 'this is the appropriate time to accelerate the release of our American citizens.' "
The official, who asked not to be identified, declined to comment further on the circumstances, or the release of any of the five detainees.
"This is not a spy swap. This is not an exchange of intelligence," the official said.
He said Trevithick had already departed Iran.
Correspondent Alexandra Koktsidis contributed to this report. Laura Krantz can be reached at firstname.lastname@example.org. Follow her on Twitter @laurakrantz. Astead W. Herndon can be reached at email@example.com. Follow him @AsteadWH. Kathy McCabe can be reached at Katherine.McCabe@ globe.com. Follow her @GlobeKMcCabe.