An excerpt from my Rights and Duties Pertaining to Kept Animals, soon to be published by Tabah Foundation.
In addition to forbidding animal abuse in general, the Prophet ﷺ also forbade taking their young, burning them, damaging their habitats, and exterminating species.
Ibn Masʿūd (may Allah be pleased with him) reported:
We were with the Messenger of Allah ﷺ on a journey when he drew apart to relieve himself. We saw a red bird that had two young ones with it. We caught them and the red mother bird came, beating the earth with its wings. The Prophet ﷺ then returned and said, “Who has distressed this bird on account of its young? Return them to her.” He also noticed an ant mound which we had burnt up. He asked, “Who has set fire to this?” We replied, “We did.” He ﷺ said, “None should torture with fire save the Lord of the fire.”((Abu Dawud, Sunan, 2675, 5268. Imam al-Nawawī, in his Riyāḍ al-ṣāliḥīn (1610), noted that the chain of transmission is ṣaḥīḥ.))
Some commentators note that the prohibition against burning an ant nest does not apply if the nest is empty.
Other hadiths show that it is sometimes permissible to kill vermin. One of these hadiths is a narration from ʿĀʾishah (may Allah be pleased with her and her father):
The Prophet ﷺ said, “Five kinds of animals are mischief-doers and can be killed even in the Sacred Precinct: rats, scorpions, kites, crows, and rabid dogs.”((al-Bukhārī, al-Ṣaḥīḥ, 4:129 3314, 3315; see also Muslim, Ṣaḥīḥ, 1198; Mālik ibn Anas, Muwaṭṭaʾ Mālik, 90.))
ʿAbd Allāh ibn Mughaffal (may Allah be pleased with him) narrated:
The Prophet ﷺ said: “If dogs were not a community (ummah) I should command that they all be killed. Rather kill every pure black one.”((Abū Dāwūd, Sunan, 3:108.2845; see also Abu Muḥammad al-Dārimī, Sunan al-Dārimī, 2051; Ibn Mājah, Sunan Ibn Mājah, 3205; Muḥammad ibn ʿĪsā al-Tirmidhī, Sunan al-Tirmidhī, 1486, 1489; Abu ʿAbd al-Raḥmān al-Nasāʾī, al-Mujtabā, 4280; Ibn Ḥibbān, Ṣaḥīḥ Ibn Ḥibbān, 5656–7.))
While these hadiths permit the killing of these specific animals as vermin, the second hadith indicates that it is not permissible to make dogs extinct due to their being a community. The Qur’an states that all flying and creeping creatures are also communities: “And there is no creature on [or within] the earth or bird that flies with its wings except [that they are] communities like you. We have not neglected in the Register (al-Kitāb) a thing. Then unto their Lord they will be gathered” (Q6:38). If the Prophet ﷺ prevented the extermination of dogs due to their being a community, it follows that we ought to similarly prevent the extermination of other animals since they, too, are also communities.