Praise be to Allah.
Allaah says, describing His noble Self and His just Wisdom, that He does not lead people astray except after His Message has reached them, and proof has been established against them, as He says (interpretation of the meaning):
“And as for Thamood, We showed and made clear to them the Path of Truth (Islamic Monotheism) through Our Messenger (i.e. showed them the way of success), but they preferred blindness to guidance” [Fussilat 41:17]
According to another view on the interpretation of this aayah, Mujaahid said concerning the aayah (interpretation of the meaning):
“And Allaah will never lead a people astray after He has guided them” [al-Tawbah 9:115] . This aayah refers to the issue of believers praying for forgiveness for the mushrikeen in particular. Allaah has made clear the ruling on this matter, it becomes a sin, so it is their choice whether they do it or not.
Ibn Jareer said: Allaah is saying that He would not decree misguidance for them as a result of their seeking forgiveness for their dead mushrik relatives, after He had guided them and given them faith in Him and His Messenger, until He had told them of the prohibition so that they would desist. But before He explained that this is not allowed, if you did that, He would not decree that you would be led astray because of that. For obedience and disobedience have to do with commands and prohibitions, but with regard to matters that have not been commanded or prohibited, no one can be considered to be obedient or disobedient.