Sahih Muslim Book 014, Hadith Number 4027.
Chapter : The vow is not to be fulfilled which is made in disobedience to Allah nor that over which a man has no control.
Imran b. Husain reported that the tribe of Thaqif was the ally of Banu 'Uqail. Thaqif took two persons from amongst the Companions of Allah's Messenger (may peace be upon him) as prisoners. The Companions of Allah's Messenger (may peace be upon him) took one person at Banu Uqail as prisoner, and captured al-'Adbi (the she-camel of the Holy Prophet) along with him. Allah's Messenger (may peace be upon him) came to him and he was tied with ropes. He said: Muhammad. He came near him and said: What is the matter with you? Thereupon he (the prisoner) said: Why have you taken me as prisoner and why have you caught hold of one proceeding the pilgrims (the she-camel as she carried the Holy Prophet on her back and walked ahead of the multitude)? He (the Holy Prophet) said: (Yours is a great fault). I (my men) have caught hold of you for the crime of your allies, Banu Thaqif. He (the Holy Prophet) then turned away. He again called him and said: Muhammad, Muhammad, and since Allah's Messenger (may peace be upon him) was very compassionate, and tender-hearted, he returned to him, and said: What is the matter with you? He said: I am a Muslim, whereupon he (the Holy Prophet) said: Had you said this when you had been the master of yourself, you would have gained every success. He then turned away. He (the prisoner) called him again saying: Muhammad, Muhammad. He came to him and said: What is the matter with you? He said: I am hungry, feed me, and I am thirsty, so provide me with drink. He (the Holy Prophet) said: That is (to satisfy) your want. He was then ransomed for two persons (who had been taken prisoner by Thaqif). He (the narrator) said: A woman of the Ansar had been taken prisoner and also al-Adbi' was caught. The woman had been tied with ropes. The people were giving rest to their animals before their houses. She escaped one night from the bondage and came to the camels. As she drew near the camels, they fretted and fumed and so she left them until she came to al-,Adbi'. It did not fret and fume; it was docile She rode upon its back and drove it away and she went off. When they (the enemies of Islam) were warned of this, they went in search of it, but it (the she-camel) exhausted them. She (the woman) took vow for Allah, that in case He would save her through it, she would offer that as a sacrifice. As she reached Medina, the people saw her and they said: Here is al-Adbi, the she-camel of Allah's Messenger (may peace be upon him). She (the woman) said that she had taken a vow that if Allah would save her on its back, she would sacrifice it. They (the Prophet's Companions) came to Allah's Messenger (may peace be upon him) and made a mention of that to him, whereupon he said: Hallowed be Allah, how ill she rewarded it that she took vow to Allah that if He saves her on its back, she would sacrifice it ! There is no fulfilment of the vow in an act of disobedience, nor in an act over which a person has no control. In the version of Ibn Hujr (the words are): "There is no vow in disobedience to Allah."