A 26-year-old Islamic extremist has been convicted of stabbing two German police officers at a riot in Bonn and sentenced to six years in prison.

Murat K., whose last name was not given in accordance with German privacy laws, was convicted Friday in Bonn state court of serious bodily harm, disturbing the peace and resisting arrest, the dapd news agency reported.

The German-born Turkish citizen didn't deny the May 5 assault, but said his religious beliefs justified his actions because the police were functionaries of the German state, which allowed a far-right group to display caricatures of the Prophet Muhammad that he found offensive.

The suspect refused to recognize the authority of the court and refused to stand for the judges, saying he answered only to his god.