Narrated Abu Huraira:The Prophet said, "A prophet amongst the prophets carried out a holy military expedition, so he said to his followers, 'Anyone who has married a woman and wants to consummate the marriage, and has not done so yet, should not accompany me; nor should a man who has built a house but has not completed its roof; nor a man who has sheep or shecamels and is waiting for the birth of their young ones.' So, the prophet carried out the expedition and when he reached that town at the time or nearly at the time of the 'Asr prayer, he said to the sun, 'O sun! You are under Allah's Order and I am under Allah's Order O Allah! Stop it (i.e. the sun) from setting.' It was stopped till Allah made him victorious.
Then he collected the booty and the fire came to burn it, but it did not burn it. He said (to his men), 'Some of you have stolen something from the booty. So one man from every tribe should give me a pledge of allegiance by shaking hands with me.' (They did so and) the hand of a man got stuck over the hand of their prophet. Then that prophet said (to the man), 'The theft has been committed by your people. So all the persons of your tribe should give me the pledge of allegiance by shaking hands with me.' The hands of two or three men got stuck over the hand of their prophet and he said, "You have committed the theft.' Then they brought a head of gold like the head of a cow and put it there, and the fire came and consumed the booty. The Prophet added: Then Allah saw our weakness and disability, so he made booty legal for us."