Praise be to Allah.
It is not permissible for a Muslim to keep a dog, unless he needs this dog for hunting, guarding livestock or guarding crops.
Al-Bukhaari (2145) narrated that Abu Hurayrah (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “Whoever keeps a dog, a qiraat from his good deeds will be deducted every day, except a dog for farming or herding livestock.”
Muslim (2978) narrated from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings of Allah be upon him) said: “Whoever keeps a dog that is not a dog for hunting, herding livestock or farming, two qiraats will be deducted from his reward each day.”
Muslim (2943) narrated from ‘Abd-Allah ibn ‘Umar (may Allah be pleased with him) that the Messenger of Allah (peace and blessings of Allah be upon him) said: “Whoever keeps a dog, except a dog for herding livestock or a dog for hunting, a qiraat will be deducted from his good deeds each day.” ‘Abd-Allah said: Abu Hurayrah said: Or a dog for farming.
Ibn ‘Abd al-Barr said: This hadeeth shows that it is permissible to keep a dog for hunting and herding livestock, and also for farming.
Ibn Maajah (3640) narrated from ‘Ali ibn Abi Taalib (may Allah be pleased with him) that the Prophet (peace and blessings of Allah be upon him) said: “The angels do not enter a house in which there is a dog or an image.” Classed as saheeh by al-Albani in Saheeh Ibn Maajah.
These ahadith indicate that it is haram to keep a dog, except for those which were exempted by the Messenger (peace and blessings of Allah be upon him).
The scholars differed as to how to reconcile between the reports which speak of one qiraat being deducted and those which speak of two qiraats being deducted.
It was said that two qiraats will be deducted if the dog is more harmful and one qiraat will be deducted if it is less so.
And it was said that that at first the Prophet (peace and blessings of Allah be upon him) said that one qiraat would be deducted, then the punishment was increased after that, so he said that two qiraats would be deducted in order to put people off from keeping dogs even more.
The qiraat is an amount that is known to Allah, may He be exalted, and what is meant is that some of the reward for a person’s good deeds will be deducted.
See Sharh Muslim by al-Nawawi, 10/342; Fath al-Baari, 5/9
Shaykh Ibn ‘Uthaymeen said in Sharh Riyaadh al-Saaliheen, 4/241:
With regard to keeping dogs, this is haram and is in fact a major sin, because the one who keeps a dog, except those for which an exception has been made, will have two qiraats deducted from his reward every day.
It is by the wisdom of Allah that like calls to like and evil calls to evil. It is said that the kaafirs, Jews, Christians and communists in the east and the west all keep dogs, Allah forbid. Each one takes his dog with him and cleans it every day with soap and other cleansing agents. But even if he were to clean it with the water of all the seas in the world and all the soap in the world, it would never become pure! Because its impurity is inherent, and inherent impurity cannot be cleansed except by destroying it and erasing it altogether.
But this is by the wisdom of Allah, and the wisdom of Allah is that like calls to like and evil calls to Shaytaan because this kufr of theirs is by the inspiration of the Shaytaan and the command of the Shaytaan, for the Shaytaan enjoins evil, immorality, kufr and misguidance. So they are slaves to the Shaytaan and to their whims and desires, and they are also evil and love vile things. We ask Allah to guide us and them. End quote.
Is it permissible to keep dogs to guard houses?
The Prophet (peace and blessings of Allah be upon him) made only three exceptions to the prohibition on keeping dogs: hunting, guarding livestock and guarding crops.
Some scholars are of the view that it is not permissible to keep a dog for any reason other than these three. Others are of the view that it is permissible to draw analogies between these three and similar or more likely cases, such as guarding houses, because if it is permissible to keep dogs to guard livestock and crops, it is more appropriate that it should be permissible to keep dogs to guard houses.
Al-Nawawi said in Sharh Muslim (10/340):
Is it permissible to keep a dog to guard houses, alleys and the like? There are two points of view. The first is that it is not permissible, because of the apparent meaning of the ahadith, which clearly state that keeping dogs is forbidden except for farming, hunting and herding. The more correct view is that it is permissible, by analogy with those three cases, knowing that the reason that is understood from the ahadith is necessity. End quote.
The view that was classed as saheeh by al-Nawawi (may Allah have mercy on him), that keeping a dog to guard the house is permissible, was also classed as saheeh by Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) in Sharh Saheeh Muslim. He said:
The correct view is that it is permissible to keep a dog to guard the house, because if it is permissible to keep a dog in order to benefit from it, as in the case of hunting, it is more appropriate that one be allowed to keep a dog in order to ward off harm and protect oneself.