They were short of food and had to eat the meat of Makroh animals such as horses and mules. In this condition, a shepherd who was looking after sheep belonging to Jewish owners came to the Prophet (PBUH) and converted to Islam, and said: These sheep belong to Jewish owners and I want to give them to you. The Prophet (PBUH) in a clear and exact manner told him: These sheep given to you in trust, and in our religion, breach of trust is not allowed. It is necessary for you to take all the sheep to the castle and return them to their owners. The shepherd obeyed the order of the Prophet (PBUH) and returned all the sheep to their owners and returned to join Muslims [1].
[1] Seerah Ibn Hisham, Vol. 3, Page 344.