By Madalena Araujo, CNN

It all started with a harmless comedy clip on Jon Stewart’s The Daily Show, in which satirical correspondent Jason Jones met with journalist Maziar Bahari in a Tehran café.

The clip marked the beginning of a partnership that would lead to Stewart’s directing and screenwriting debut. Or maybe that just happened by chance, Stewart told CNN’s Christiane Amanpour in an interview that aired Wednesday.

“I had always wanted to be in the Directors’ Guild. And so I was looking for anything. And the script had come across – it could have been a Martin Lawrence, Will Smith buddy comedy. It really didn’t matter to me,” he joked.

“Rosewater” tells the story of Bahari’s months-long-imprisonment in Iran following his coverage of the 2009 presidential election. Stewart told Amanpour that he and Bahari became friends after the journalist was released.

“He was writing the book at that time and when I started seeing the sheets of it and the galleys, he has an incredible ability to compartmentalize the pain of the experience to be able to maintain an ability to analyze it, to connect it to his family, his culture, his past. It was such a rich tapestry. The book is so compelling that I wanted to be a part of it,” he said.

Bahari tried to keep his sense of humor throughout his ordeal and insisted on highlighting the absurdity of the situation, which he said “comes from reality.”

“They wanted to implicate me. They had a scenario for me and they told me that I was a spy for the CIA, MI-6, Mossad, and Newsweek. And in the absence of any evidence, because I was not a spy, they brought ridiculous charges, including this Daily Show appearance,” Bahari said.

Amanpour asked Bahari if he thinks he will be able to go back to Iran. “I can always go back. But it’s difficult to come out, because I have a sixteen-and-a-half year sentence. I have a sixteen-and-a-half year sentence and seventy-four lashes,” he laughed.

The Daily Show host also stressed that the suppression of journalists is not just happening in Iran.

“You know it’s [happening in] Turkey, all these Al Jazeera reporters are being held in Egypt. The United States has prisoners in solitary. We put pressure on journalists. You see that now. It’s – this is a ubiquitous issue. We don’t want it to be just dismissed as the eccentricity of one authoritarian regime,” Stewart said.

He hopes people feel optimistic after watching “Rosewater.”

“What I would like them to take away is oddly enough optimism and a sense of that … these types of oppressive regimes, this type of authoritarian regime is unsustainable, as we learned that colonialism was unsustainable, that we learned that imperialism was unsustainable,” Stewart said.

He also thinks one of the film’s strongest messages is the fact that Bahari, who spent 107 days in solitary confinement, kept his spirit intact.

“I think it’s the idea that Maziar, even under the type of duress that he was, was able to retain his humanity through his memories of his family, of his culture, of remembering his own humanity,” Stewart added.