In prison with al-Shabab: What drives Somali militants?
After a year locked up in Uganda with self-confessed Islamist militants, a Kenyan human rights lawyer is able to give clues as to what drove those behind Kenya's deadly mall siege, writes the BBC's Will Ross.
"They have a conviction that what they are doing is right and the rest are wrong," says Al Amin Kimathi about the members of the Somali group al-Shabab who bombed bars in the Ugandan capital, Kampala, where patrons were watching the 2010 World Cup final on TV.
"The conviction comes from what they would say is an act of faith," says Mr Kimathi.
Following the bombings, in which 76 people died, Mr Kimathi accused Kenya and Uganda of illegal rendition - arresting suspects in Kenya and sending them to Uganda without due process.
He was then arrested himself and accused of involvement in the bomb plot - a charge he denies.
Al-Shabab said it carried out the attack because Ugandans at the time made up the bulk of the African Union force in Somalia (Amisom).
Mr Kimathi's case never went to trial and he was released in September 2011.
In prison he had lengthy conversations with the al-Shabab members, including those who planted the bombs.
"They are given quotations from the Koran, the Hadiths [Prophet Muhammad's teachings], but they do not have the benefit of a critical mind to look at it in any other context and they trust the people driving them to this," he says.
"Advantage is taken of this person's feeling of desperation and that is dangerous enough to drive them over the top.
"They are given the feeling that they are a very important person and that martyrdom is something to aspire to - the anger over their deprivation is lowered to a feeling of comfort, to a point where the only thing they aspire to is a collective action.
"Whether that action leads to their survival or death that doesn't really matter any more."
Mr Kimathi says he challenged the young al-Shabab members in prison to say which Koranic authority gave them the right to take innocent lives.
After discussions they would often admit they were wrong: "In a lot of instances you would even see a lot of remorse. But they would just come back with the mere argument of revenge.
"They would say: 'Look you have not been out there in Somalia during this whole war - we've been there and we've seen the kind of attacks by the Ugandan forces and African Union forces, the kind of raids they conduct and this [Kampala attack] is nothing compared to what we've seen out there.'"
Mr Kimathi believes that despite being brainwashed, it is still very possible to pull sympathisers back from the brink of committing violence.
"One thing that needs to be done is to identify people who have that kind of mindset, reach out to them - which is rarely done - and show them that they belong, people care about them and that people are not hunting them - because they feel they are hunted."
Outside the Jamia Mosque in the centre of Kenya's capital, Nairobi, where worshippers were being screened with metal detectors before praying, people told me why they thought young men were being enticed to join groups like al-Shabab.
"Our young people are being used," says one man leaving the mosque.
"They don't have a job and if someone offers them some little money they'll do anything."
Another man said: "They are too desperate to earn money - some are earning less than $1 (£0.60) a day so they are easily misused.
"This person is willing and ready to do anything that is offered to him."
He said a solution could be found in Islamic schools, or madrassas.
"But the teachers there need formal education so they understand the importance of getting a proper education.
"A lot of money comes to Kenya through free primary education but those madrassas are left out."
Young men 'overlooked'
There are counter-radicalisation programmes in Kenya but some analysts suggest they rely too heavily on a counter-terrorism approach - with the police and army leading the way.
"There are still plenty of existing grievances in Kenya and in the wider region that mean people will be animated by the kind of issues that fuel al-Shabab and will be determined to join either al-Shabab or other networks allied to al-Qaeda," says Cedric Barnes, project director for the Horn of Africa at the International Crisis Group (ICG).
Those social grievances include marginalisation not just in north-east Kenya, where most Somalis live, but also in coastal districts.
While in any big city, particularly Nairobi, there will be people who feel they are not getting a chance.
"Young men in particular, I think, suffer from feeling overlooked and not getting opportunities that they see others getting," says Mr Barnes.
Al-Shabab has been severely weakened inside Somalia where it has lost territory to the foreign troops fighting under the banner of Amisom over the past two years.
September's Westgate shopping centre attack seemed to be sending out the message - "we are not a finished force" - but al-Shabab also hopes to provoke a reaction which will boost the group.
"The Kenyan people and government now control the next move," Somalia expert Ken Menkhaus wrote on the American political blog, ThinkProgress.
"If they respond to this terrible tragedy with restraint and respect for due process and rule of law, they will do more to undermine al-Shabab than all of the counter-terrorism operations conducted inside Somalia.
"If the deadly attack succeeds in prompting vigilante violence by Kenyan citizens or heavy-handed government reactions against Somali residents, al-Shabab stands a chance of recasting itself as the vanguard militia protecting Somalis against external enemies.
"It desperately needs to reframe the conflict in Somalia as Somalis versus the foreigners, not as Somalis who seek peace and a return to normalcy versus a toxic jihadi movement," writes Mr Menkhaus.
Mr Kimathi also knows there is a danger of playing into al-Shabab's hands, because he has seen the way young people have reacted upon release after years in detention.
"They come out angry and indeed you would even hear in the first minutes of release somebody coming out and saying: 'I am going to [get] revenge - I cannot stand these sort of injustices any more.'
"Right now there is so much sympathy for the authorities, even from those people who have stood at the borderlines of extremism," Mr Kimathi says.
"If they can see the investigation and operations are being conducted within the bounds of some civil order then there is going to be quite a lot of collaboration and co-operation."
But what if there is a heavy-handed response?
"Then they risk feeding into the vicious cycle of recruitment and offering fodder for more terrorist propaganda," Mr Kimathi warns.