Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
1- Islam encourages every good action and urges Muslims to show mercy to all the creatures of Allah, including birds and beasts.
2- Caging birds and offering food to them and treating them kindly is not only permissible, but also recommended.
3- A Muslim should take the example of the Prophet (peace and blessings be upon him) who was sent as a ‘mercy for all creatures“.
Examining this issue, the prominent Muslim scholar Sheikh `Abdul-Bari Az-Zamzami, member of the Moroccan scholar’s Association, answers:
Caging birds and offering food to them and treating them kindly is not only permissible, but also recommended.
A Muslim will receive a reward from Allah for that as long as he has made the intention that he is doing this for the sake of Allah.
The Prophet (peace be upon him) said: “In every living liver (i.e. living being), there is a reward.” (Al-Bukhari)
In another hadith, the Prophet (peace be upon him) is reported to have said: “And if you show mercy to a sheep, Allah will shower mercy on you.” (Al-Bukhari in Al-Adab Al-Mufrad)
Keeping birds and offering food to them may preserve their lives, since they are safe from predatory animals.
It is also recorded that there was a boy at the time of the Prophet called Abu `Umair and he used to keep a small bird with him all the time. Whenever he saw his family in the house, the Prophet (peace be upon him) used to call this boy, smile at him and say: “What has happened to An-Nughair (the name of the bird)?”
Some scholars used this hadith and deduced about 400 benefits from it. This behavior of the Prophet indicates that it is permissible to keep birds at home and offer them food.
Allah Almighty knows best.