Sahih al-Bukhari 4051
Sahih al-Bukhari · Book 64: Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi) · “…but Allah was their Wali.”
Narrated Jabir:
حَدَّثَنَا مُحَمَّدُ بْنُ يُوسُفَ ، عَنِ ابْنِ عُيَيْنَةَ ، عَنْ عَمْرٍو ، عَنْ جَابِرٍ ـ رضى الله عنه ـ قَالَ نَزَلَتْ هَذِهِ الآيَةُ فِينَا {إِذْ هَمَّتْ طَائِفَتَانِ مِنْكُمْ أَنْ تَفْشَلاَ} بَنِي سَلِمَةَ وَبَنِي حَارِثَةَ، وَمَا أُحِبُّ أَنَّهَا لَمْ تَنْزِلْ، وَاللَّهُ يَقُولُ {وَاللَّهُ وَلِيُّهُمَا}
This Verse: "When two of your parties almost Decided to fall away..." was revealed in our connection, i.e. Bani Salama and Bani Haritha and I would not have liked that, if it was not revealed, for Allah said:-- But Allah was their Protector.....(3.122)