A court has jailed two teachers in southern Bangladesh for making derogatory comments about Islam and the Prophet Muhammad.

Magistrate Anwar Parvez told The Associated Press the case began when students at Hijla High School in Bagerhat district complained that the assistant teacher of a science class on Sunday dismissed the Quran as the word of Allah and said there was no heaven.

Parvez said Tuesday that a mob including students, parents and villagers attacked the teachers from a small, Hindu community with sticks, forcing them to lock themselves in a room until police intervened.

The magistrate said the assistant teacher pleaded guilty to publicly insulting a religion, and both he and the school's head teacher were then sentenced to six months behind bars.