It is reported from Sayyiduna Imran bin Husayn (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) ransomed two men of the Muslims, whom Thaqif had captured, in exchange for a polytheist man from Banu Uqayl, and Banu Uqayl were allies of Thaqif in the Jahiliyyah (pre-Islamic era). Thaqif had captured two men from among the Muslims, so the Muslims captured a man from Banu Uqayl and also seized a she-camel of his that had outrun the pilgrims in the Jahiliyyah. In the Jahiliyyah it was the custom that a she-camel which won a race would not be prevented from drinking at any watering trough, nor from any pasture where it could graze. So the man sat in a place, and the Prophet (peace and blessings be upon him) passed by him, and he said: O Muhammad, for what crime am I and the pilgrims' outstanding she-camel being held? He (peace and blessings be upon him) said: "We have held you because of the crime of your allies, Thaqif." (Then the narrator narrated the full hadith.)
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 15547