Messenger of Allah ﷺ ordered the killing of dogs and then said: what is the trouble with them (the people of Medina)? How dogs are nuisance to them (the citizens of Medina)? He then permitted keehing of dogs for hunting and (the protection of) herds.
أَمَرَ رَسُولُ اللَّهِ ﷺ بِقَتْلِ الْكِلاَبِ ثُمَّ قَالَ مَا بَالُهُمْ وَبَالُ الْكِلاَبِ ثُمَّ رَخَّصَ فِي كَلْبِ الصَّيْدِ وَكَلْبِ الْغَنَمِ