How does a Muslim safeguard his Islam in the lands of the non-Muslim?

Shaykh Muqbil ibn Hādī al-Wādiʿī:

He safeguards his religion by having zeal and holding firmly onto the Islamic evidences, and associating with the pious. It has been narrated in the authentic two (Ṣaḥiḥayn) on the authority of Abī Mūsa al-Ashʿarī, who cited the statement of the Prophet ﷺ; “The example of a good companion and a bad companion is that of a perfume seller and a black smith. The perfume seller would either give you something or you would buy from him, or you would come across a pleasant scent from him, as for the black smith, either he would burn your clothes or you would encounter a bad scent from him.” (Refer to Muslim no. 2628). Allāh ﷻ said about the people of paradise in His ﷻ Noble Book:

قَالَ قَائِلٌ مِّنْهُمْ إِنِّي كَانَ لِي قَرِينٌ ۞ يَقُولُ أَإِنَّكَ لَمِنَ الْمُصَدِّقِينَ ۞ أَإِذَا مِتْنَا وَكُنَّا تُرَابًا وَعِظَامًا أَإِنَّا لَمَدِينُونَ ۞ قَالَ هَلْ أَنتُم مُّطَّلِعُونَ ۞
۞فَاطَّلَعَ فَرَآهُ فِي سَوَاءِ الْجَحِيمِ  ۞  قَالَ تَاللَّهِ إِن كِدتَّ لَتُرْدِينِ ۞  وَلَوْلَا نِعْمَةُ رَبِّي لَكُنتُ مِنَ الْمُحْضَرِينَ

Then they will turn to one another, mutually questioning. A speaker of them will say: “Verily, I had a companion (in the world). Who used to say: “Are you among those who believe (in resurrection after death)?” “(That) when we die and become dust and bones, shall we indeed (be raised up) to receive reward or punishment (according to our deeds)?” (The man) said: “Will you look down?” So he looked down and saw him in the midst of the Fire. He said: “By Allāh! You have nearly ruined me. “Had it not been for the Grace of my Lord, I would certainly have been among those brought forth (to Hell).” (Q 37:51-57)

The Poet says: “Do not enquire about a person; rather enquire about his companions, For every companion emulates whom he accompanies.” Those who say: “This [evil action] is permissible” and “So-and-so is too harsh”. Upon you is to be cautious of and distance yourself from them. You should demand proof.

[Allāh ﷻ said]:

۞ وَيَوْمَ يَعَضُّ الظَّالِمُ عَلَىٰ يَدَيْهِ يَقُولُ يَا لَيْتَنِي اتَّخَذْتُ مَعَ الرَّسُولِ سَبِيلًا  ۞ يَا وَيْلَتَىٰ لَيْتَنِي لَمْ أَتَّخِذْ فُلَانًا خَلِيلًا
۞ لَّقَدْ أَضَلَّنِي عَنِ الذِّكْرِ بَعْدَ إِذْ جَاءَنِي ۗ وَكَانَ الشَّيْطَانُ لِلْإِنسَانِ خَذُولًا


And (remember) the Day when the wrong-doer will bite at his hands, he will say: “Oh! If only I had taken a path with the Messenger. “Ah! Woe to me! Would that I had never taken so-and-so as a friend! “He indeed led me astray from the Reminder (this Qurʾān) after it had come to me. And Satan is ever a deserter to man in the hour of need.” (25:27-29)


Also by abstaining from the local customs and bad things that one became accustom to prior to Islam. The soul inclines towards what it is accustomed to, so it is a must that he stays away from that and accompanies the pious Muslims. The Prophet ﷺ said, “A man is upon the religion of his friend. So let each of you enquire about whom he befriends.” (Refer to al-Albānī, Ṣaḥiḥ al-Tirmidhī no.1937)