Jason Rezaian, the Washington Post foreign correspondent recently released from a jail in Iran, was enamoured with that country. Just two years ago, he and his wife, who is also a reporter, were optimistic about the future.

It was early in the summer of 2014 and the two journalists were in a café in Darband, a leafy district where locals come to escape Tehran's heat.

The couple were being interviewed by Anthony Bourdain, the host of the CNN travel show Parts Unknown.

Story continues below advertisement

Mr. Rezaian explained how much he wanted to give readers a more nuanced portrayal of a country often demonized by American politicians and media.

"When you walk down the streets, you see a different side of things. People are proud. The culture is vibrant. People have a lot to say."

A dual U.S.-Iranian citizen, he missed some things about his native California – avocados, burritos – but embraced his complicated life in Iran, his late father's country of origin.

"I love it and I hate it, you know," he told Mr. Bourdain. "It's home. It's become home."

Six weeks later, Mr. Rezaian and his wife, Yeganeh Salehi, were arrested. After two months, she was let go on bail. He remained in custody and was charged with espionage.

Monday, after Mr. Rezaian was released during the weekend as part of a prisoners' swap, he was in a hospital in Germany, recovering from 18 months of detention. At one point, he was kept in solitary confinement for 49 days, the Washington Post reported.

His family had previously said he lost weight, had a back problem because his cell didn't have a bed and suffered from various infections.

Story continues below advertisement

And it is unlikely he could return soon to the country that had much shaped his identity and career.

He had gone there, trying to show a more positive image of a country at a crossroad. Instead, he had ended up at Tehran's Evin Prison, where a decade ago, the Montreal-based photojournalist Zahra Kazemi had been detained and beaten to death.

The 39-year-old Mr. Rezaian was born in the San Francisco area, the son of a businessman who immigrated from Iran in 1959.

According to his mother, Mary Breme Rezaian, from an early age, the young Jason was fascinated by the culture, history and food of his father's ancestral land.

He didn't get to travel to Iran until he was in his mid-20s.

In a 2008 documentary he co-wrote, Mr. Rezaian noted that his parents had never applied for Iranian citizenship for him, creating visa problems for him when he started working as a freelance writer.

Story continues below advertisement

He became a dual citizen, which eased some of the red tape, but eventually would be held against him when he was arrested.

He married Ms. Salehi, an Iranian citizen who worked for the Abu Dhabi newspaper, The National.

His initial years in Iran were spent sharing stories about the changes in a country isolated by years of economic sanctions because of its nuclear program and its support for militant movements in the Middle East.

"The American public and their leaders need to see the real Iran, all its parts," he told his mother.

Just after Barack Obama was elected president in 2008, Mr. Rezaian applied for a job with the new administration, citing his familiarity with Iran.

Martin Baron, the Post's executive editor, said the application was done online. Mr. Rezaian got a form response by e-mail but never got a job.

Story continues below advertisement

Nevertheless, that correspondence would be cited one day by Iranian authorities as evidence that Mr. Rezaian had some connection with the Obama White House.

Few Western journalists are allowed to work permanently in Iran. The Post hired Mr. Rezaian in 2012, the year before the election of President Hassan Rouhani, a relative moderate.

"He has reported not just on political developments in Tehran but also on social issues, such as a water shortage, and cultural developments, including a nascent Iranian appetite for baseball," the Post said in an editorial after his arrest.

He and his wife were taken into custody the evening of July 22, 2014. It would be five months before he was charged. After a closed-door trial, he was convicted last October.

Observers believe that Mr. Rezaian was held because of the power struggle between reformers and hard-liners in the judiciary who wanted to embarrass Mr. Rouhani.

Despite last-minute delays, Mr. Rezaian flew out of Tehran Sunday. His brother, Ali, told CNN that Mr. Rezaian was still in hospital, but in "good spirits."