Surah Al-An'am 6:88
ذَٰلِكَ هُدَى ٱللَّهِ يَهْدِى بِهِۦ مَن يَشَآءُ مِنْ عِبَادِهِۦ ۚ وَلَوْ أَشْرَكُوا۟ لَحَبِطَ عَنْهُم مَّا كَانُوا۟ يَعْمَلُونَ
That is the guidance of Allāh by which He guides whomever He wills of His servants. But if they had associated others with Allāh, then worthless for them would be whatever they were doing.
Translation: Saheeh International
Tafsir
That religion to which they were guided is God’s guidance wherewith He guides whom He will of His servants; had they hypothetically speaking been idolaters all that they did would have been in vain.
Excerpt from Tafsir al-Jalalayn, commentary on 6:88, via Quran.com. The reader has the full commentary and 9 more tafsirs.