If Allaah wills, He can seal the heart from guidance. Abdullah bin ‘Amr bin al-‘Aas said, that he heard Allaah’s Messenger saying,

“All the hearts of the offspring of Aadam are between two fingers of Ar-Rehman’s Fingers, as one heart. He turns it (in any direction) as He wills. Then Allaah’s Messenger said, “O Allaah! The Turner of the hearts, turn our heart towards Your obedience.” [Saheeh Muslim vol.4, p.1397, no.6418]

The Importance of supplicating for steadfastness, and uprightness in the religion upto the end of one’s life.

Indeed the Prophet (sallahAllaahu alayhi wasallam) used to do so, and taught us to do so, as in the hadeeth of Umm Salamah by Shihr who said : ‘I said to Umm Salamah : ‘O Mother of the Believers, what is the duaa’ which the Prophet (sallahAllaahu alayhi wasallam) would supplicate the most while in your presence? ’

So she said : ‘The frequent supplication of his was :

يَا مُقَلِّبَ الْقُلُوبِ ثَبِّتْ قَلْبِى عَلَى دِينِكَ

“O, Turner of the hearts, turn our hearts to Your obedience.”

And also reported by Imaam Ahmad , from the hadeeth of ‘Aisha (radhiyaAllaahu anha): ‘The Dua’ which the Prophet (sallahAllaahu alayhi wasallam) used to supplicate with a lot…’ then she mentioned it.