Praise be to Allah the Lord of the Worlds.
In principle, a modern Muslim should be a model for the country where he resides. This is achieved by preserving identity and values and making use of the privileges available in that country. This way, he becomes an active member of its community and an honorable representative of Islam. This is particularly when he earns the right to establish the rituals of Islam, such as prayer, fast, Zakat, and avoids grave sins, such as drinking alcohol, eating swine and committing adultery. If this is the case, there is nothing wrong with his staying in that country to study, work, invite to Islam, and evade persecution and the like.
However, if he didn`t enjoy freedom of belief and religious practice, then he isn`t allowed to remain in that country, be it Muslim or non-Muslim. Scholars of Hadith are of the view that the above narration applies to this case, adding that it targets the Muslim who feels insecure for his religious freedom.
The Hadith is from Jarir bin 'Abdullah who said : "The Messenger of Allah (PBUH) sent a military expedition to Khath'am. So some people (living there) sought safety by prostrating, but they were met quickly and killed. News of this reached the Prophet (PBUH) upon which he commanded that they be given half of the 'Aql (blood money). And he said: "I am free from every Muslim that lives among the idolaters." They said:"O Messenger of Allah: How is that ?" He said: "They should not see each other's campfires." {Abu Dawoud & Tirmithi}.
Ibn Hajar stated: "This Hadith applies to the one who feels insecure for his religious freedom." {Fateh Al-Baarie, 39/6}.
Moreover, Al-Haithami stated: "If he could practice the rituals of his faith for his status and that of his people and felt secure for his belief and religious practice, then he isn`t obliged to leave that country (Non-Muslim).
Other scholars said that the Hadith isn`t authentic, Al-Bukhari said that it is incompletely transmitted and Abu Hatim Al-Razi said it is defective.
Supposing that the above Hadith is authentic, there is a reason for reporting it, and this explains its implication: some Muslims were living among the idolaters and were killed by Muslim fighters when battle took place, so the Prophet (PBUH) relieved the latter from paying their Diyah (Blood money) and cleared them from liability before Allah the Almighty. If the above Hadith is understood within this context, then it contains no evidence proving that staying in a non-Muslim country is absolutely forbidden, as some people claim. And Allah the Almighty knows best.