Egypt’s prisons are notorious for brutal practices toward political prisoners that experience torture on a daily basis. But the grim prison environment isn’t just a question of human rights violations – it also cultivates extremism.

26-year-old Egyptian-American Mohamed Soltan was one of the estimated 41,000 political dissidents and journalists jailed in Egypt since July 2013. According to Soltan, what he witnessed during imprisonment led him to the conclusion that Cairo is complicit in helping extremist groups, and primarily the self-proclaimed Islamic State, recruit new members, the Intercept reported.

"The regime is fostering an environment in their prisons that makes them a fertile ground for that kind of ideology to flourish," Soltan said. "The brutality and the overwhelming loss of hope is creating a situation which fits [the Islamic State's] narrative, and they're using it to try and recruit people and spread their message."

Soltan was among a group of media activists and journalists broadcasting protests against the new regime of Egyptian military dictator Abdul Fattah al-Sisi in Cairo's Raba'a Square. He was arrested soon after the protest was cleared, during a major crackdown on civil society activists, journalists, members of the deposed government or whomever the current government considered its opponents.

From the very first day in prison, Soltan says he was subjected to brutal beatings. Even though his arm was wounded, he was forced to repeatedly run through two rows of guards along with other newcomers. During the sprints the detainees were beaten by their captors with batons, whips and fists. And that was only the beginning of the nightmare.

Placed in such cruel circumstances, with routine beatings, torture and humiliation, people start to grow desperate and lose hope, Soltan said. And that's when IS comes in with their recruitment efforts.

"Everyone felt depressed and betrayed, except for the [IS] guys. They walked around with this victorious air and had this patronizing and condescending attitude towards everyone else," Soltan recalled.

Taking into account the conditions prisoners endure day after day, it's not surprising that the rhetoric of IS members often manages to convince hopeless prisoners in the justice of their cause.

"The [IS] guys would come and tell everyone these nonviolent means don't work, that Western countries only care about power and the Egyptian regime only understands force," Soltan explained. "When you're in that type of situation and don't have many options left, for some people these kinds of ideas start to make sense."

Soltan was released this year after a 400-day hunger strike, during which he was consistently intimidated by guards. And it was those same guards that would let IS members walk into his cell and try to radicalize him.

"They would come into my cell and start telling me this nonviolent stuff like hunger striking doesn't work," Soltan claimed.

US government intervention on Soltan's behalf helped secure his freedom. Ironically, despite the Obama administration's criticism of human rights violations by the Sisi government, Washington continues to send Cairo some $1.5 billion in mostly military aid annually.