“There is not an animal or creature that lives and moves on communities like you. We have not neglected anything in the Book and they [all creation] shall be gathered to their Lord in the end.”
Prophet was against detaining or confining or restraining animals for no genuine reason. Also, he didn’t like lashing animals or hitting them. He used different teaching styles to emphasize the spiritual call to treat animals with care and dignity.
“There is not an animal or creature that lives and moves on communities like you. We have not neglected anything in the Book and they [all creation] shall be gathered to their Lord in the end.”
Quran, 6:38