The Command to call on Allah when Calamity strikes, to repel Evil with that which is better, and to seek refuge with Allah
Allah commands His Prophet Muhammad ﷺ to call on Him with this supplication when calamity strikes:
رَّبِّ إِمَّا تُرِيَنِّى مَا يُوعَدُونَ
(My Lord! If You would show me that with which they are threatened.) meaning, `if You punish them while I am witnessing that, then do not cause me to be one of them.' As was said in the Hadith recorded by Imam Ahmad and At-Tirmidhi, who graded it Sahih:
And say, ` 0 my Lord, I seek your refuge from the strokes of the Shaitan, and I seek Your refuge from that they come to me.' (23:97, 98)
The word هَمَز (the infinitive of هَمَزَاتِ Hamazat translated above as 'strokes' ) means "to push, to press" and sometimes is also used to mean "to make a call from behind". This is a very comprehensive prayer often invoked for protection from the guile and mischief of Shaitan and the Holy Prophet ﷺ has urged upon the Muslims to recite it frequently in order to avoid sudden bursts of rage which are brought about by the promptings of and which cause people to lose self-control. This prayer is also very effective in repelling other assaults of Shaitans and Jinns. Sayyidna Khalid ؓ suffered from insomnia and the Holy Prophet ﷺ suggested that he should recite the following prayer before going to bed :
I seek refuge with Allah's Perfect Words from Allah's wrath and His punishment, and from the evils of His slaves, and from the strokes of the Shaitans and from that they come to me.
Sayyidna Khalid ؓ did as advised and was soon cured of insomnia.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 95–97
This prayer illustrates that a believer is always a God-fearing man. Even when God’s punishment is directed towards others, he starts trembling with fear. He starts addressing God in all humility, because he knows that, if he is to be saved, it will not be by any deed of his or by his own strength but by God’s mercy.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.