Islam forbids Muslims to keep dogs, and the punishment for that is the loss of one or two qirats from one’s hasanat (good deeds) each day. An exception is made for keeping dogs for hunting or guarding.

`Abdullah ibn `Umar (may Allah be pleased with him) is reported to have said that the Prophet (peace and blessings be upon him) said, “Whoever keeps a dog, except a dog for herding livestock or a dog that is trained for hunting, will have two qirats deducted from his reward each day” (Al-Bukhari and Muslim).

In this regard we would like to quote Sheikh Muhammad Al-Mukhtar Ash-Shinqiti, who stated:

If the dog is taken for Islamically acceptable purposes such as guarding and hunting or protecting one’s soul and property, there is nothing wrong with doing so and it does not take away any good deeds. Allah has praised the people of the cave and among what has been mentioned about them is [their dog stretching forth his two forelegs on the threshold] (Al-Kahf 18:18) and the Qur’an mentions the dog three times in Surat Al-Kahf.

Also, the Prophet (peace and blessings be upon him) allowed taking dogs for protecting cattle and for hunting.

However, taking a dog only as a pet is forbidden in Islam and doing so has a lot of harms. According to the authentic hadith, “It would decrease his good deeds by the equivalent of qirat”.