Indeed, to Allāh belongs the dominion of the heavens and the earth; He gives life and causes death. And you have not besides Allāh any protector or any helper.
Allah describes His Honorable Self and just judgment in that He does not lead a people astray but after the Message comes to them, so that the proof is established against them. For instance, Allah said,
وَأَمَّا ثَمُودُ فَهَدَيْنَـهُمْ
(And as for Thamud, We showed and made clear to them the path of truth ...) 41:17. Mujahid commented on Allah's saying;
(And Allah will never lead a people astray after He has guided them) "Allah the Mighty and Sublime is clarifying to the believers about not seeking forgiveness for the idolators in particular, and in general, it is an exhortation to beware of disobeying Him, and encouragement to obey Him. So either do or suffer." Ibn Jarir commented, "Allah says that He would not direct you to misguidance, so that you invoke Him for forgiveness for your dead idolators, after He gave you guidance and directed you to believe in Him and in His Messenger ! First, He will inform you of what you should avoid, so that you avoid it. Before He informs you that this action is not allowed, you would not have disobeyed Him and fallen into what He prohibited for you if you indulge in this action. Therefore, in this case, He will not allow you to be misguided. Verily, guidance or misguidance occurs after commands and prohibitions are established. As for those who were neither commanded nor prohibited, they can neither be obedient nor disobedient in doing what they were neither ordered nor prohibited from doing." Allah said,
This put some Muslims into doubt. Was it not, they thought, that Sayyidna Ibrahim ؓ too had prayed for his disbelieving father? To answer it, the second verse (114) was revealed: مَا كَانَ اسْتِغْفَارُ إِبْرَاهِيمَ. In gist, it means: As for the prayer made by Sayyidna Ibrahim ؓ for his father, it was conditioned by circumstances. In the beginning, Sayyidna Ibrahim ؓ did not know that he would keep on sticking to his disbelief right through the end and would die a disbeliever. In other words, his going to Hell was not certain. That was the time when he had made the promise that he would pray for his forgiveness: سَأَسْتَغْفِرُ لَكَ رَبِّي (I shall ask my Lord to forgive you - Maryam 19:47). Later, when it be-came clear to Sayyidna Ibrahim ؓ that he was an enemy of Allah, that is, he had remained a disbeliever right through the end, he elected to become indifferent to him and stopped asking pardon for him.
Abraham, being a very compassionate person, was greatly concerned about the salvation of humanity. Swayed by these sentiments, he had made a pledge to pray to God for his pagan father. But, when he was made aware of God’s will, he desisted. God has instilled in every human being a natural instinct for discerning evil. When an individual receives a message which is intended to stop him from committing an evil deed, his whole inner being testifies to its truth. A silent check is produced in his heart. For ‘God would never lead a people astray after He has guided them.’ But if the man ignores this impulse arising from within, and does not save himself, in spite of the hint given him by nature, his natural sensitivity gradually goes on weakening, till a time comes when it dies altogether. This danger threatens Muslims as well as non-Muslims.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.