He has learned to button his shirt using only his left hand, to roll his sleeve with his teeth, to balance on his right foot in the shower. He cannot forgive, though he is desperate to forget. But at night his dreams betray him.

This is how it happened, Abdulle told the Guardian. He was a prisoner in an insurgents' house in Mogadishu, lying on his side, one hand chained to his ankles. He was 17, with fluff on his cheeks and unspeakable fear in his heart. Three other young men were with him – Jalylani, Ali, Abduqadir.

A guard, from the Islamist group al-Shabaab, which is trying to overthrow the Somali government, gripped his shoulder. "Ismael Khalif Abdulle, come with me."

A convoy of rebel battlewagons cleared the way through the battered streets. Reaching Masalah, an old military barracks, he saw his mother through the car window and shouted to her. The guard slapped his face. "Today is not the day to call your mother," he said.

Ordered to witness the punishment of the "spies and bandits" or face lashes themselves, the entire neighbourhood had assembled. Also watching were some of the Shabaab's top leaders – Sheikh Mukhtar Robow, the Somali-Swede Fuad Shangole, and Abu Mansoor Al-Amriki, the American who recruits and finances foreign fighters.

In the middle of the stony parade ground were about 20 militiamen in green fatigues. Their faces were masked. They were wearing surgical gloves. On the ground was a single plastic mattress.

Abdulle says he was made to lie down. His left hand was tied to his right ankle with a thick rope, leaving the other limbs free for what was to come. Rubber surgical tubing bit into his right biceps – a tourniquet. One rebel grabbed his hand, another his forearm. They pulled in opposite directions as a piece of plastic was laid over his wrist.

"Please make it quick," he pleaded.

A heavily built man drew a large wooden-handled knife normally used to slaughter camels. The knife descended.

Though their horror was far from over, Abdulle and the three other young men "cross amputated" – a process of cutting off a hand and foot from opposite sides of the body – by the Shabaab on 26 June 2009, eventually escaped from their Islamist captors, and managed to cross to the government-controlled side of the city. Abdulle recently managed to flee Somalia, and reach a safehouse in Nairobi, Kenya, where he gave this interview.

His story offers a rare insight into how the Shabaab is using its extreme interpretation of Islam to establish order through fear – and to find recruits.

Abdulle was born in 1992, a year after the last effective government fell, and warlords took over the country. As far as it is possible to have a normal upbringing amid the anarchy, he did. Once Shabaab forces took full control of the Bakara market area where he lived, in early 2009, security immediately improved – but at a huge cost to personal and social freedoms.

"If you saw a man on the street with a beard, you would be worried," Abdulle said. "But if someone was smoking a cigarette, you felt OK."

The Shabaab recruited some of Abdulle's classmates to fight the government, but he insists that he never had anything to do with the Islamists until the day he was abducted.

He said he was not told of his alleged crime until the 26th day of detention, when he and the three other young men were taken to the old military parade ground for the first time. Pistols and mobile phones, allegedly stolen by the accused, were shown to the crowd. Abdulle insists on his innocence to this day, but he was given no chance to speak. Dahir Ga'may, a Shabaab "judge", merely announced his verdict.

"He said we were guilty as spies and thieves, and that under sharia law a hand and a foot must be amputated."

Three days later, the sentence was carried out. Abdulle passed out while his hand was being cut off. After he regained consciousness he heard the screams as the amputations continued. It was several hours before they were given pain relief, and two days before their wounds were stitched.

A fortnight later, Shangole, the Shabaab commander, arrived at the house where they were detained. "He said they had made a mistake. Our legs were cut too low down, and needed to be shortened. He took the end of my leg, and put three fingers above the stump and said: 'That's where it should be.'"

This time, the surgical tool was a plumber's saw. As before, there were no painkillers.

On a separate visit, Ga'may told them that as they were disabled they should become suicide attackers. Sensing a chance to escape, they agreed. A taxi called by a relative picked them up, and took them to the justice ministry. The Red Crescent Society in Mogadishu fitted him with an artificial limb.

His passage out of Mogadishu was risky, as the Shabaab were still after him. In Nairobi, he's keeping a low profile, as the insurgents have supporters in the city. His hope now is to gain asylum and help to deal with the physical and mental scars.

Troubled youth

Harakat al-Shabaab al-Mujahideen, better known as al-Shabaab – "the youth" – first rose to prominence in 2006 as the armed wing of a sharia court alliance that forced warlords from the Somali capital, Mogadishu. After invading Ethiopian troops routed the nascent Islamist movement later that year, the Shabaab re-emerged as a guerilla army, initially winning the sympathy of many Somalis – and attracting hundreds of foreign jihadis. Once Ethiopia withdrew in January 2009, Shabaab militants took over large partsmuch of south and central Somalia, training their guns on government forces and African Union peacekeepers. It quickly established security, and delivered social services, but the group's extreme interpretation of Islam and its targeting of civilians has alienated most Somalis. Its "clerics" have banned everything from films to mobile ringtones, school bells and gold fillings. Public amputations of hands and feet are now common, and stonings and beheadings have been reported. Shabaab suicide bombers have killed dozens of innocent people.