Mohammed Ezzouek began to pray. He believed his death was imminent and that it would be bloody and brutal. The 23-year-old from west London could hear men talking in Somali. "They were saying: 'You lot are al-Qaida' and laughing," he recalls. "They were saying, 'You lot are going to get it'."

Ezzouek had had little idea what was happening to him as he and 15 or so other men had their hands tied behind their backs and were bundled onto a plane that left the Kenyan capital Nairobi in the dead of night. By the time the plane had landed just after sunrise, Ezzouek had managed to work his blindfold free an inch.

He saw men with rows of "bullets strapped along their chests", carrying "big guns". "I remember seeing through the window some guys lying down on the runway, their eyes blindfolded and their hands tied. It was like a scene in a film where people have already been executed. I thought, 'Oh my gosh, they're going to kill us.' Everyone thought they were going to die so I started praying. There was nothing you could do; there was no point in crying."

Ezzouek wondered whether this country in which they had landed – and in which he thought he was going to die – was Ethiopia or Somalia. He thought of his family back in Britain. He could have been forgiven for wishing he had agreed to the deal the British agents had offered him just days before in Nairobi. On several occasions, they promised him: "Confess to being a terrorist and you can return to the UK."

But Ezzouek and three other Britons on the plane, who had all fled the Somalian capital of Mogadishu for Kenya in late 2006 as the American-backed Ethiopian forces swept into the country, had repeatedly protested their innocence to their British interrogators.

Although he had been held in a pitch-black cell measuring three metres by two and a half – in which conditions were so cramped that some of the 20 inhabitants had to stand for hours on end – every time he had been hauled out he would tell the British agents the same thing: he had gone to Somalia because he wanted to live under sharia law as enforced by the Islamic Courts, the Islamist alliance that back then governed much of the war-torn country, a faction of which has been linked to al-Qaida.

Ezzouek told the agents that he had entered Somalia by flying from Heathrow to Dubai and then from Dubai to Mogadishu. He had told his family what he was going to do. It was hardly the furtive journey of an al-Qaida operative.

Having fled Somalia, Ezzouek had made his way through the jungle and then to Kenya by boat. "I had no idea a war was going to happen," he said. "If I was someone who was looking for trouble, I would not have been someone who turned up in Mogadishu several months beforehand, but a couple of weeks before the fighting broke out. The Ethiopians had bombed the airport so the only way to leave was across the border to Kenya. It was fight or run." It was a dangerous journey, he said. "Helicopters kept flying overhead, dropping bombs and firing rockets across the whole region."

Finally, after almost two weeks of travelling and being holed up in a Kenyan mosque, the exiled group, which included women and children, were captured by the Kenyan army. Ezzouek and his three fellow Britons were transferred to a cell in a police station in the back streets of Nairobi where they were held for almost three weeks. "It was like a horror movie, no lights, completely black, mosquitoes everywhere. You can't imagine it," Ezzouek said.

During this time, early 2007, the four were regularly taken from their cell and smuggled through the back entrance of an upmarket hotel in downtown Nairobi. In a luxurious suite they were questioned by two men who identified themselves as agents with the British security service. Ezzouek asked them if he could phone home.

"I said to them what about my family? No one knows whether I'm dead or alive. Can I make a call to them?" They said: 'No you can't.' It was then that I realised what these people were about."

He was shown photographs of alleged terrorists and asked if he knew them. "They asked me about the 1998 Kenya-Tanzania bombings. I said I remembered exactly where I was during the bombings – I was in secondary school. They were so desperate to pin anything on anyone."

The Kenyan security services also subjected him to interrogations that started at sunrise and were repeated every couple of hours. One Kenyan agent suggested: "Maybe we're being too nice to you. Maybe, Mohammed, if we bring other people to you, you will co-operate, people who will make you talk."

As the questioning progressed and Ezzouek became increasingly anxious, unable to eat and fearing for his sanity, a senior British intelligence agent who identified herself as "Frances" arrived from London. The questioning became more threatening. Fran ces told Ezzouek nobody knew where he was and that "anything could have happened to him".

"She said how would you like it if the Kenyans were to take you to the Somalia/Ethiopia border, within sight of an Ethiopian checkpoint and then leave you to sort yourself out?" It was a terrifying threat, given that Ezzouek had fled the Ethiopians in the first place.

Frances became increasingly angry that Ezzouek was sticking to his story. "She said: 'Look, Mohammed, I did not come all the way from London to Nairobi to hear you say you went to Somalia for an Islamic education. There are serious people back home who are going to be unhappy with this explanation.' I said: 'What do you want me to tell you?' She said: 'I want you to tell me you went to Somalia to fight with those terrorists.'"

The implicit threat that Britain would wash its hands of one of its citizens was never far away during the interrogations. Ezzouek, who was born in Britain to Moroccan parents, was asked if he was happy spending the rest of his life in his Kenyan police cell. One of the British agents told him: "For your people, there's no such things as solicitors, lawyers; you're another breed."

After three weeks of questioning, the British agents seemed to have run out of lines of questioning. It was then that Ezzouek and his three fellow Britons – Reza Afsharzadagen, Hamza Chentouf and Shajahan Janjua – were flown out of Kenya to Somalia.

Ezzouek said they had been accompanied by a group of "brothers", fellow exiles from Mogadishu who had come from Jordan and Saudia Arabia and other parts of the Middle East. It was these men whom Ezzouek had seen from beneath his blindfold, tied up on the runway in Somalia the morning he thought he was about to be executed. Some of the "brothers" were not as lucky as the Britons. Ezzouek later discovered from lawyers that they had been rendered to Ethiopia, where they had been beaten and tortured.

Ezzouek and his three compatriots were placed in a dank, dark cellar in the city of Baidoa, the then home to Somalia's transitional government, which was fiercely opposed to the Islamic Courts.

Bullet holes in the bolted wooden door provided the only light. The men were forced to urinate in a bottle in one corner of their makeshift prison while Somalian military guards held muttered conversations above them. On one occasion, Ezzouek heard a cockney accent. He is convinced British security agents were in the area at the time he was held.

The four might have stayed in Somalia indefinitely. No one, apart from British intelligence, knew they were there and the agents had apparently washed their hands of them. But back in Britain, questions were being asked at the Foreign Office. Shortly before the men had been flown out of Kenya, Janjua had bribed a guard and contacted his family by mobile phone, telling them where he and the others were being held.

The four families were put in touch with the charity Reprieve, which campaigns to free those held in Guantánamo Bay. Reprieve contacted the UK government. That night police raided the family homes of the four, battering down the doors and removing computers and papers.

Looking back, Ezzouek says he now realises the British agents stopped quizzing the four of them only when they realised Janjua had managed to contact his family in Britain. From that moment, the four were no longer invisible.

"That's when they stopped interrogating us," he said. "I didn't know that was why at the time. If Sha [Janjua] hadn't made the phone call, we would have ended up in Ethiopia or somewhere else. The agents were so angry with him when they found out he had made the call. They said 'You've ruined everything, you don't know what you've done.'"

After three days in Baidoa, a British Foreign Office official arrived and took the four back to Britain where they were released without charge.

Ezzouek has never spoken about his ordeal before and is still wary about speaking out two years afterwards. Now 25, his conversation peppered with street slang and wearing trainers and a parka coat, he seems little different from other twentysomethings. Only his long beard and his frequent thanks to Allah hint at his profound religious beliefs and his desire to live in a sharia state.

But his story threatens to haunt the government. It shines fresh light on the lengths the security services were allegedly prepared to go to by allowing British nationals to be held in dehumanising conditions, without legal representation, out of sight of the law and where the threat of torture was ever-present.

Such treatment contradicts the government's insistence that it "works hard with international partners to stop the practice of torture and of cruel, inhuman or degrading treatment". However, the government has refused to provide clarification on what guidance and policies it has given to British agents to prevent their collusion in the torture and mistreatment of detainees abroad.

What is known is that the guidelines were altered between 2002 and now. Written instructions given to MI5 and MI6 officers in 2002 stipulated they were under no obligation to intervene to prevent detainees from being mistreated. "Given that they are not within our control, the law does not require you to intervene to prevent this," the 2002 policy stated. It was amended in 2004, according to the government, which will not explain why or how.

Now, in a landmark move, Reprieve is to launch legal proceedings, seeking a judicial review into the policies governing the actions of British intelligence agents when interviewing detainees abroad. The litigation is designed to elicit what the 2004 policy is and whether it is still in use. Reprieve's lawyers have requested the government provide them with a copy. In a letter to Treasury Solicitors, which provides legal services to government, which has been obtained by the Observer, Reprieve claims: "All of the available evidence which we have outlined... suggests that the 2004 policy is unlawful because it fails to instruct service personnel that they must not obtain evidence in circumstances giving rise to complicity in torture."

As part of the legal challenge, Reprieve and its lawyers, Leigh Day & Co, have submitted numerous examples of what they allege are the security services' complicity in the ill treatment, rendition and torture of British and foreign nationals up to 2008, suggesting the policy changes introduced by the government had little effect.

The case of Ezzouek, and the three other Britons known collectively as the "Nairobi Four", will form part of the legal challenge, as will well-known cases such as that of Binyam Mohamed, who was allegedly tortured in Morocco, during which he answered questions sent to his interrogators by British intelligence.

Other, lesser-known examples cited in the legal challenge, include that of Salim Awadh, a Kenyan detained in Ethiopia who, according to Reprieve, was beaten for several months, after which he was questioned by British agents, and Khaled al Maqtari, who was violently beaten in Abu Ghraib in Iraq, where he was interrogated by British Special Forces.

The examples are troubling, according to Reprieve's director, Clive Stafford Smith, because they suggest British intelligence agents were prepared to go to extraordinary lengths to keep Britons out of the reach of British protection, even if it meant, as in Ezzouek's case, they were rendered to hostile regimes.

Stafford Smith says such a tactic must have been deliberate. "We know from the 2002 policy that high-up people in government approved a policy of turning a blind eye to torture," he said. "We know that a 2004 policy amended the 2002 policy. We know the government desperately wanted to cover that up. But when we look back on the last seven or eight years, the thing we're going to find more pernicious than the torture is the effort to cover up the torture. The only question is how long before all this comes out?"

Allegations of British complicity in torture

Allegations of British complicity in torture and the mistreatment of British nationals held abroad on suspicion of being involved in terrorism date back years and are fiercely rejected by the government. In 2006, the Pakistan-based lawyer who was acting for a British man, Zeeshan Siddique, told the Observer her client was routinely questioned by MI6 officers after being abused by the country's notorious intelligence agency, the ISI. The case of Siddique, who was returned to the UK with damage to his eye and later absconded after being placed on a control order, was one of the first to trigger concern among human rights groups.

But it has emerged that those in British intelligence have also raised concerns. Parliament's 2005 Intelligence and Security Committee report referred to concerns raised by a British agent about the treatment of a suspect interviewed abroad. According to the ISC report, the agent wrote to his superiors asking for clarification of his obligations to the suspect, suggesting that at the very least the guidelines were far from clear. Several other cases of British agents interviewing suspects abroad who were allegedly at risk of torture have subsequently come to light.

In July, the Joint Committee on Human Rights called for the government to publish all the legal opinions provided to ministers concerning the relevant legal standards on torture and complicity in torture. It followed an announcement in March by the prime minister, Gordon Brown, of a review of the current policy on interrogation. Brown promised to publish the current policy "once it has been reviewed by the Intelligence and Security Committee", but since then the government has declined to provide more information.

Tomorrow, the government will be back in the high court as it attempts to prevent the disclosure of any documents that may reveal the extent of UK government complicity in the mistreatment and torture of British resident Binyam Mohamed, who was interrogated in Pakistan and Morocco.

Given the government's extensive use of the courts to block legal attempts to shine light on the actions of British agents abroad, and its apparent reluctance to publish its interrogation guidelines, campaigners may have to wait until after the next election for a breakthrough.