DUBLIN -- An Irish citizen recently acquitted after four years of being imprisoned in Egypt says he saw dozens of cellmates become radicalized and adopt views of the Islamic State of Iraq and Syria (ISIS) during his brutal captivity in overcrowded jails.

Ibrahim Halawa, 21, was arrested after security forces broke up a 2013 sit-in protesting the army's overthrow of an elected Islamist president, and was released in October after being held in a half-dozen detention centers. His experience provides a unique perspective on how conditions inside Egypt's notorious prisons have degenerated during an unprecedented crackdown on dissent.

Irish citizen Ibrahim Halawa poses with an Irish flag as he arrives at Dublin Airport on October 24, 2017 following his release from detention in Egypt. Getty

Born in the Dublin suburb of Crumlin to parents of Egyptian descent, Halawa had faced death by hanging on charges that ranged from inciting violence to murder, and says regular beatings with bars and metal chains during captivity led him and others to the brink of despair.

Get Breaking News Delivered to Your Inbox

"In the beginning, no one had even heard of Daesh, but by the time I left, maybe 20 percent were openly supporting their ideas," he said, using the Arabic acronym for ISIS. "It could have been just talk - many of them were engineers, students and doctors who just wanted to get home to their families - but after all those years of being in jail with no explanation, many wanted revenge."

The extremist group boasts a powerful affiliate in Egypt's northern Sinai that has stepped up attacks in recent years, killing hundreds of security forces and civilians and expanding its reach to the mainland. Last month gunmen waving the group's black flag killed 300 people at a Sinai mosque in the deadliest terror attack ever carried out in the country.

Authorities have meanwhile waged a sweeping crackdown on dissent. Human rights groups say as many as 60,000 political prisoners are being held in Egyptian jails, mainly Islamist supporters of ousted President Mohammed Morsi but also several prominent secular activists.

Halawa said prison officials routinely described him and his cellmates as "political prisoners," even writing it on cells that were built to hold 10 men but were packed with dozens. The Egyptian government, which has branded Morsi's Muslim Brotherhood group a terror organization, denies holding any political prisoners.

"The prisons were packed -- originally there were many members of the Muslim Brotherhood and April 6 (secular youth movement) but new people were always coming in," he said. "Toward the end, the guards became really rough with us because they saw people who left were returning still politicized, posting their views on Facebook."

Halawa was detained in the summer of 2013, just a few days after the army cleared out mass protests against the overthrow of Morsi, whose awkward one-year rule divided the country. Hundreds of protesters were killed.

Halawa and his sisters travelled regularly to Egypt for vacation, and had arrived that summer, just after he finished secondary school exams.

"I had no clue what was going on in Egypt at the time. I went to a few protests, including anti-Morsi ones, but everyone did back then, and I wanted to see all sides," he said. Only after friends were killed by the military did he accept an invitation to speak on stage at the main sit-in, where he said organizers were inviting anyone to address the crowd.

"The place was full of lots of simple people who were just against military rule, like farmers who earned ($50) a month. And at the stage, they were desperate for speakers, especially foreigners," he said.

In this Nov. 21, 2017 photo, Irishman Ibrahim Halawa, who was recently acquitted after four years of imprisonment in Egypt, poses for a photograph with his sister Fatima Halawa, at his their home, in Dublin, Ireland. AP

Halawa's Egyptian-born parents urged him and his sisters to avoid the demonstrations, but their curiosity got the better of them, he said. His father, Hussein, is the imam for Ireland's largest Muslim community, in Dublin, and both he and Ibrahim insist they have nothing to do with the Brotherhood.

"Our relatives in Egypt aren't political at all, and everyone knows this -- even the prosecutors and police never accused us of being a pro-Brotherhood family. My sisters and I, by going to a simple protest, were the most politically involved in the family," he said. Authorities released his three sisters after three months' detention.

Halawa says he had a typical Irish childhood, even playing Gaelic sports like hurling. But as a devout Muslim of Egyptian descent who looks older than his age, he was seen by authorities as a threat. When they found him sheltering in a mosque during street clashes, it confirmed their suspicions.

Despite speaking only rudimentary Arabic at the start of his sentence, he was treated as an Egyptian in prison, beginning with the customary welcome beating guards referred to as "the party."

"The food was often rotten, although I luckily got packages from the Irish Embassy," he said. "It was pretty corrupt in there, the guards could accuse anyone of anything and the charges would stick." Prisoners were often punished when high-profile attacks were carried out against the state over the years, such as the assassination of the prosecutor-general in 2015.

"When that happened they gave us a thorough 'inspection,' dumping out all our things in the middle of the cell and throwing food and water on it," he said. "They also made us stand under the sun all day sometimes, but other times when they tried to get information they'd offer me extra food."

Human rights groups say torture and other abuses are rampant in Egyptian prisons. Egyptian officials deny any systematic abuse and say individuals are held accountable for any violations.

Toward the end of Halawa's imprisonment, the Brotherhood -- previously known for organizing inmates in detention -- had lost much of its pull inside jail, he said, with only die-hards sticking with the group.

"Most people wanted nothing to do with them after four years, they just wanted to get out so they'd avoid associating with them," he said.

Halawa's case -- a collective trial with nearly 500 defendants -- began to be resolved only in March of this year, the first time he was allowed to come before a judge to declare his innocence. While most of the accused received sentences of between five years and life imprisonment, Halawa and some 50 others were declared innocent. He was released on Oct. 18 and returned home.

Now he hopes to finally begin his studies in computer science and business, and get on with his life. Grateful for the sustained support of human rights organizations and the Irish government, he also wants to campaign for the unjustly detained, especially his countrymen.

"There are plenty of people out there imprisoned like I was for no reason, so I'd like to help."