On February 18, 2003, Kettani was arrested by Moroccan authorities. On September 23, he was sentenced to 20 years in prison in connection with the 2003 Casablanca bombings, for which authorities accused him of being an ideological leader. Kettani denied this and asserted that his conviction was politically motivated and illegal. Human rights groups criticized his sentencing as unfair. In June 2005, he and 664 other Islamists began a hunger strike in prison to protest their convictions. Moroccan politician Mohamed Bouzoubaa criticized the move as being more concerned with politics than human rights, though Kettani's lawyer Mustafa Ramid upheld that he and other Islamists were victims of unjust trials. A second hunger strike took place at the prison in Kenitra in 2010 though most detainees ceased after negotiations with authorities; Kettani continued the strike longer than all other detainees, continuing to uphold his innocence and demand a reopening of his case.