A man from the Ansar invited him and Abdul-Rahman bin Awf and gave them wine to drink, before wine had been prohibited. Ali then led them in the Maghrib prayer and recited "Say, O disbelievers," but he became confused in his recitation. So the verse was revealed, "Do not approach prayer while you are intoxicated, until you know what you are saying" [Nisa 4:43].
حدثنا مسدد حدثنا يحيى عن سفيان حدثنا عطاء بن السائب عن أبي عبد الرحمن السلمي
أن رجلا من الأنصار دعاه وعبد الرحمن بن عوف فسقاهما قبل أن تحرم الخمر فأمهم علي في المغرب فقرأ قل يا أيها الكافرون فخلط فيها فنزلت {لا تقربوا الصلاة وأنتم سكارى حتى تعلموا ما تقولون}
[Its isnad is hasan] Tirmidhi transmitted it in tafsir of the Quran, chapter On Surah Nisa, hadith 3026, from the hadith of Ata bin Saaib, with this wording, and he said, hasan gharib sahih.