It was 1am on 1 August this year when my best friend Rae and I were caught trying to cross into Syria from Iraq. Crouching in the dark, waiting for the signal from our Kurdish fixers to run, we could see the border no more than 100 yards away. Then a shout rang out. Suddenly we were surrounded by an Iraqi Peshmerga border patrol, yelling at us to hit the ground.

Membership Event: Guardian Weekend Live

I’m a security guard from Preston; Rae is a railworker from north Wales. We’re both committed socialists. When we read about the socialist and feminist revolution that the Kurds are building in northern Syria (known as Rojava), we wanted to show our solidarity, so we saved up and bought plane tickets to Sulaymaniyah in northern Iraq. We spent nine days there before we were met by the fixers who would smuggle us into Rojava, via Iraqi Kurdistan. Crossing over legally was not an option, as the authorities in Iraqi Kurdistan are doing their best to undermine Rojava’s revolution.

“You’re Isis,” the soldiers kept shouting. “We kill Isis.” They blindfolded us, put guns to our heads and told us we would be executed on the spot. I was terrified. No one knew where we were. I closed my eyes and waited. But they didn’t shoot. Instead, they drove us to Erbil General Security Directorate, a huge, shiny, US-built compound in the capital of Iraqi Kurdistan.

Our cell was 5m x 13m, and occupied by 100 men. Inmates ranged from drug dealers to westerners who’d fought Isis with Rojava’s Kurdish People’s Protection Units (YPG). Walking into the cell, I was filled with a mixture of fear and adrenaline. But a Brazilian, a Spaniard and a Frenchman came up to us and told us that if we westerners stuck together, we’d be fine. The Brazilian whispered, “Welcome to hell.”

We had no idea how long we would be held. At night, the only way to sleep was to lie on our sides against each other, like sardines. The guards never turned off the light. They were sadistic, dishing out beatings for things as minor as laughing in their presence. Incredibly, though, they left me and Rae alone. I later learned they’d been told to go easy on us because we were revolutionaries, not fighters. The others weren’t so lucky.

The mock execution had frightened us so badly that we became numb to what we saw. But I think the constant light, fear of beatings and boredom sent some men insane. Three tried to kill themselves while we were there. There was so little to do that there were fights over who’d mop the floor. On the plus side, it meant the cell was always spotless. The food was OK – bread, yoghurt, goat or chicken, plus rice or boiled potatoes cut into soggy fingers – but what we would have given for a plate of chips and gravy.

Experience: a coup interrupted our wedding Read more

There were moments of humanity, too, such as learning chess from a 70-year-old former mujahid called Sarhan, or teaching Billy Bragg songs to the revolutionary Kurds, which they loved (especially Power In A Union). On my 21st birthday, the western prisoners managed to get a small cake smuggled in. It was the first time I felt that somebody, apart from Rae, cared about me. There were members of Isis there, too, such as Deniz, a 25-year-old from Germany who loved 50 Cent and ran a gym in Frankfurt before converting to Islam.

At first, neither our families nor the British government had any idea where we were. We began to wonder if we’d ever get out. The guards allowed us only two five-minute phone calls in 40 days. We rang the only number we knew by heart: Rae’s mum. She was amazing. She rang the British consulate in Erbil, who ultimately negotiated our release.

On 10 September, the consul- general picked us up. “Go and pay your $340 visa fines, get the next flight home and do not come back,” he said. We were elated. We landed at Heathrow three days later and went straight for fish and chips.

I wake up some mornings and think I’m still in jail. I remember the revolutionary Kurds and YPG westerners, without whom I’m not sure we’d have got through the experience. I’m sure most are still there. I don’t regret trying to get into Syria, just getting caught. The experience taught me I’m mentally tougher than I thought: if I survived that, I can survive anything.

• As told to Matt Blake

Do you have an experience to share? Email experience@theguardian.com