Sayyiduna Imran bin Husayn (may Allah be pleased with him) said: The Companions (may Allah be pleased with them) of the Messenger of Allah (peace and blessings be upon him) took a man of Banu Uqayl captive, tied him up and threw him on the stony ground called al-Harrah. The Messenger of Allah (peace and blessings be upon him) passed by him while we were with him; or (the narrator) said: he (peace and blessings be upon him) came riding a donkey, with a velvet cloth beneath him (peace and blessings be upon him). The man called out: O Muhammad! He (peace and blessings be upon him) came to him and asked: "What is your matter?" He said: Why was I seized? He (peace and blessings be upon him) said: "You have been seized for the crime of your allies, Thaqif." And Thaqif had taken two men from the Companions (may Allah be pleased with them) of the Prophet (peace and blessings be upon him) captive. He said: O Muhammad! O Muhammad! He (peace and blessings be upon him) asked: "What is your matter?" He said: I am a Muslim. He (peace and blessings be upon him) said: "Had you said this while you were in control of your own affair (that is, before your capture), you would have attained complete success." He (peace and blessings be upon him) left him there and went on. He called out again: O Muhammad! He (peace and blessings be upon him) came back and asked: "What is the matter?" He said: I am hungry, feed me; and I am thirsty, give me water. He (peace and blessings be upon him) said: "This is your need." Then the Messenger of Allah (peace and blessings be upon him) ransomed him in exchange for the two men whom Thaqif had taken captive.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قسم الفيء والغنيمة / 12842