Lawyers representing a man convicted of terrorism offences yesterday are to launch an appeal and embark on a civil action on his behalf alleging that he was tortured by Pakistani intelligence agents before being questioned by officials from the British security service, MI5.

In a case that echoes claims made by several British terrorism suspects detained in Pakistan in recent years, Rangzieb Ahmed says that he suffered brutal mistreatment at the hands of the country's notorious Inter-Services Intelligence (ISI) agency shortly before being questioned by two MI5 officers.

The jury at Manchester crown court that convicted Ahmed of being a member of al-Qaida and of directing a terrorist organisation was not told that three of the fingernails of his left hand had been removed. Ahmed, 33, from Rochdale, says the nails were removed slowly with a pair of pliers over three consecutive days at a secret ISI prison, and alleged that on the fourth day he was hooded and bound and taken to a place where he was questioned by two MI5 officers.

Nor did the jury hear that MI5 and officers from Greater Manchester police passed questions to the ISI to be put to Ahmed during his interrogation.

Before the trial began, the judge, Mr Justice Saunders, rejected an application by Ahmed's lawyers that the case should be thrown out because of the alleged mistreatment. His ruling also dismissed Ahmed's claim that his fingernails had been extracted shortly before he was questioned by MI5. The response from MI5 to the allegations that it had colluded in Ahmed's torture were heard in camera, however, after the press and the public had been excluded from the court.

Part of the judge's ruling on the matter is also being kept secret, so it remains unclear what he had to say about Ahmed's treatment while a prisoner in Pakistan.Ahmed's lawyer, Tayab Ali, said he would be appealing against both the judge's ruling and the jury's verdict.

"We are also considering civil action against the British state for failing to protect him while he was in the custody of the Pakistani authorities," he said.

While giving evidence during legal argument before his trial, Ahmed's description of the cell in which he says he was tortured matched closely that of the cell where Salahuddin Amin, 33, from Luton, says he was repeatedly tortured during 10 months in ISI custody two years earlier. Amin, who has since been convicted of terrorism offences and is serving a life sentence in the UK, says he was repeatedly tortured by ISI officers in between interviews with MI5 officers.

Ahmed says that he was beaten with sticks, whipped with electric cables, sexually humiliated and deprived of sleep. Some time later, he says, the nail of the small finger of his left hand was removed while he was asked questions about contacts in Lahore.

He told the court: "The officer said to the guards: 'Put him on the floor.' I laid down on the floor, face down. One of them grabbed my right leg, one of them held my left leg, and one of them held my right arm straight in front of me. I was still handcuffed, and one of them held the cuffs over my left hand against the floor."

Ahmed says that one of the interrogators sat on the floor beside him and forced the jaws of the pliers beneath the left side of his small fingernail. He then slowly prised the side of the nail upwards. "They started asking the same questions, who is waiting for you in Lahore? I was saying: 'I will tell you everything, I will tell you everything. Leave me and I will tell you everything.' It was very painful, I was crying out, I was screaming. I said 'leave me, please God,' but they were not listening."

Ahmed says that his interrogator then began slowly raising the right side of the nail. Next, the pliers were placed under the middle, and the entire nail slowly raised and removed. The process, Ahmed says, took between four and eight minutes.

Then, he says, he was lifted on to a stool and a man in western clothes came into the room and gave him a painkilling injection in his forearm. Ointment was applied to the wound, which was wrapped in plastic and bandaged. He was blindfolded and hooded again, led to his cell and allowed to sleep.

Ahmed alleged that on two subsequent days he was subjected to the same torture, while being asked questions about two of the perpetrators of the July 2005 suicide attacks on London's transport network and about a plot against the United States. On each occasion, he says, he was given a painkilling injection at the end of the process.

There have been allegations that four other British citizens have been questioned by British intelligence officers, thought to have been from MI5, after being tortured by the ISI or other Pakistani agencies. One, a London medical student, was detained after the July 2005 attacks in London and held in a building opposite the offices of the British deputy high commission in Karachi.

He alleges that he was beaten, whipped, deprived of sleep and forced to witness other detainees being tortured, then questioned by British intelligence officers. Consular officials repeatedly told his father that they had no idea of his whereabouts. The student was eventually released, with an apology, and resumed his studies. He now works at a hospital on the south coast of England, but remains traumatised.

Rangzieb Ahmed was found guilty of directing terrorism - the first person to be convicted of the offence in the UK. He was also convicted of membership of al-Qaida, and of possession of an article for a purpose connected to terrorism.

Habib Ahmed, who is unrelated, was found guilty of membership of al-Qaida, professing to be a member of the same organisation, possession of an article for a purpose connected with terrorism, namely three books, and possessing a document or record likely to be useful to a person committing or preparing an act of terrorism. Both will be sentenced today.

Habib Ahmed's wife, Mehreen Haji, 28, was cleared of two counts of arranging funding for the purposes of terrorism.

The evidence: case based on surveillance

During Ahmed's trial, prosecutors did not rely upon anything that had been gleaned during his interrogation in Pakistan.

Instead, they brought their case against him on the basis of surveillance evidence that had been gathered in Manchester and Dubai before he was detained, and on the basis of items seized from him and a second defendant, Habib Ahmed, 29, a Manchester taxi driver, who is no relation.

The court heard how Rangzieb Ahmed travelled to Dubai from Pakistan in December 2005 and was set to fly out to South Africa as part of a "major activity", but that the plans were changed after Hamza Rabia, a senior al-Qaida leader, was killed in an explosion.

Habib Ahmed was summoned to collect three diaries and the pair returned separately to the United Kingdom shortly afterwards.

Manchester detectives were monitoring the two men and bugged their hotel room in Dubai, where they made several coded references to al-Qaida. The surveillance continued in Manchester.

Rangzieb Ahmed was detained in August 2006 after returning to Pakistan, and deported to the UK 13 months later.

When Habib Ahmed was arrested he was found to be in possession of two diaries, which had details of senior al-Qaida terrorists written in invisible ink, described in court as a terrorist's contact book.