Imam `Ali ibn al-Husain Sayyid as-Sajjidin related from his father from his grandfather the Prophet of Allah that this supplication was taught by the Angel Jibra'il to the Prophet during one of the battles.