It was narrated by Ahmad (3528) from ‘Abdullah ibn Mas‘ood, who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “No person suffers any anxiety or grief, and says: ‘Allaahumma innee ‘abduka wa ibn ‘abdika wa ibn amatika, naasiyati bi yadika, maadin fiyya hukmuka, ‘adlun fiyya qadaa’uka, as’aluka bi kulli ismin huwa laka sammayta bihi nafsaka aw anzaltahu fi kitaabika aw ‘allamtahu ahadan min khalqika aw ista’tharta bihi fi ‘ilm il-ghaybi ‘andak an taj’ala al-Qur’aana rabee’ qalbi wa noor sadri wa jalaa’a huzni wa dhahaaba hammi (O Allah, I am Your slave, son of Your slave, son of Your female slave, my forelock is in Your hand, Your command over me is forever executed and Your decree over me is just. I ask You by every Name belonging to You which You named Yourself with, or revealed in Your Book, or You taught to any of Your creation, or You have preserved in the knowledge of the unseen with You, that You make the Qur’an the life of my heart and the light of my breast, and a departure for my sorrow and a release for my anxiety)’ but Allah will take away his sorrow and grief, and give him in their stead joy.” It was said: O Messenger of Allah, should we not learn them (these words)? He said: Yes indeed; whoever hears them should learn them.”
Classed as saheeh by al-Albaani in as-Silsilah as-Saheehah, 199.
