Ibn Mughaffal reported: Allah's Messenger (ﷺ) ordered the killing of dogs and then said: what is the trouble with them (the people of Madinah)? How dogs are nuisance to them (the citizens of Madinah)? He then permitted keeping of dogs for hunting and (the protection of) herds. In the hadith transmitted on the authority of Yahya, he (the Holy Prophet (ﷺ)) permitted the keeping of dogs for (the protection of) herds, for hunting and (the protection of) cultivated land.