All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
We have already issued Fatwa 87551 on the ruling of fighting and arguing in the mosque. Whoever is raising his voice, arguing and fighting inside the mosque, and disturbing or harming the congregation, should first be advised and reminded with Allaah and with the sacredness of the mosque which should be free from fighting and idle talk and raising the voice. If he takes heed and stops hassling the Muslims, then all perfect praise be to Allaah, but if he persists in what he is doing after being reminded and advised, then there is no harm to drive him out of the mosque or prevent him from entering as per the view of the scholars this is by analogy to the harm caused by a person who eats garlic and then attends congregational prayers. It is confirmed that the Prophet used to order the congregation to drive out from the mosque a person who has eaten garlic or onions to Al-Baqee' graveyard. [Muslim]
Ibn 'Abdul-Barr said: 'By analogy; any person who harms people in the mosque, like being foul-mouthed [obscene] and abusive, or does anything from which people are harmed, then it is permissible for the congregation in the mosque to drive him out of it as long as he is persistent in harming and disturbing the people. However, if he stops harming the congregation and regains his sagacity, or repents, or that he takes heeds by any other means, then he may come again to the mosque.'
Allaah Knows best.