Can Muslims settle in kaafir countries for the sake of a better life?
Question

 
I live in a western country, and I can practice my religion without much difficulty, praise be to Allah. I have seen on your site some ahaadeeth of the Prophet (peace and blessings of Allah be upon him) which forbid Muslims to settle in kaafir lands or to live among the kuffaar. I am now confused about whether to go back to my country or to stay in this country, knowing that if I go back to my country, I will encounter hardship and persecution because of my adherence to the laws of Allah, and I will not be able to find freedom of worship such as I enjoy in the country where I live now.
I hope that you can answer my question and explain the ruling on my staying in this country, especially since the Muslim countries are no longer very different from others with regard to adherence to the laws of Islam.
Praise be to Allah. 
The basic principle is that it is not permissible for the Muslim to settle among the mushrikeen if he is unable to practice his religion openly while being able to emigrate to a Muslim country. This is indicated by evidence from the Quran and Sunnah.
In the Quran, Allah says (interpretation of the meaning): 
“Verily, as for those whom the angels take (in death) while they are wronging themselves (as they stayed among the disbelievers even though emigration was obligatory for them), they (angels) say (to them): “In what (condition) were you?” They reply: “We were weak and oppressed on the earth.” They (angels) say: “Was not the earth of Allah spacious enough for you to emigrate therein?” Such men will find their abode in Hell — what an evil destination!”
[al-Nisa’ 4:97]
In the Sunnah, the Prophet (peace and blessings of Allah be upon him) said: “I disown every Muslim who settles among the mushrikeen.” Narrated by Abu Dawood, 2645; classed as saheeh by al-Albaani in Saheeh Abi Dawood. 
With regard to common sense, the Muslim who settles among the mushrikeen cannot carry out many of the rituals and visible acts of worship of Islam, in addition to the fact that he is exposing himself to temptation because of the permissiveness in those countries that is protected by their laws. The Muslim should not expose himself to temptations and trials. 
This is if we look at the evidence of the Quran and Sunnah without paying attention to what is really happening in Muslim countries and kaafir countries. But if we look at what is really happening in Muslim countries, we cannot agree with the questioner when he says, “Especially since the Muslim countries are no longer very different from others with regard to adherence to the laws of Islam.” But this generalization is not correct. The Muslim countries are not all the same with regard to how closely or otherwise they adhere to the laws of Islam. Rather they vary in that, and even within one country, regions and cities may vary in that regard. 
Similarly the kaafir countries are not all the same with regard to their permissiveness and moral laxity; they also vary in that regard. 
So given that the Muslim countries vary, as do the kaafir countries, and given that the Muslim cannot go to a Muslim state and settle there because of visa and strict settlement laws etc, and that a Muslim may not be able to practice his religion in some Muslim countries, when he may be able to do so in whole or at least in part in some kaafir countries – for all these reasons it is impossible to issue a general ruling that will cover all countries and all individuals. Rather we should say that each Muslim has his own unique set of circumstances and his own ruling that applies to him, and each person is accountable for himself. If he is able to practise his religion in the Muslim country in which he lives more than he can in a kaafir country, then it is not permissible for him to settle in a kaafir country. But if it is the other way round, then it is permissible for him to settle in a kaafir country, subject to the condition that he is confident that he can resist the desires and temptations to be found there by taking the precautionary measures prescribed in sharee’ah. 
There follow some comments of the scholars which support what we have said above: 
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked about this matter and he said: This is one of the most difficult issues nowadays because countries vary, as stated above, and because for some Muslims, if they go back to their homelands they will be persecuted for their religion whereas they are safe from that in the kaafir countries. But if we say that it is haraam for them to settle among the kuffaar, then where is the Islamic state that will accept them and allow them to settle there?! This is the meaning of what he said, may Allah have mercy on him. 
Zakariya al-Ansaari al-Shaafa’i said in his book Asna al-Mataalib (4/207): 
It is obligatory to migrate from the kaafir lands to the Muslim lands for those who are able to do that, if they are unable to practise their religion openly. 
Ibn al-‘Arabi al-Maaliki said: Hijrah (migration) means leaving dar al-harb [non-Muslim lands] and going to dar al-islam [Muslim lands]. This was obligatory at the time of the Prophet (peace and blessings of Allah be upon him) and remains so after his time for those who fear for their lives. From Nayl al-Awtaar, 8/33, by al-Shawkaani. 
Al-Haafiz Ibn Hajar said concerning the hadeeth, “I disown every Muslim who settles among the mushrikeen”: 
This is to be understood as referring to those who are not safe to practise their religion there. Fath al-Baari, commentary on hadeeth no. 2825 
In al-Mawsoo’ah al-Fiqhiyyah (20/206) it says: 
Dar al-harb refers to every place in which the rule of kufr prevails. One of the rulings that have to do with dar al-harb is hijrah (migration). With regard to migration from dar al-harb, the fuqaha’ divided people into three categories: 
(a) Those who are obliged to migrate: they are those who are able to migrate and who cannot practise their religion openly in dar al-harb. It is obligatory upon a female even if she does not have a mahram, if she thinks she will be safe when travelling, or if the risk of travelling is less than the risk of staying in dar al-harb…
(b) Those who are not obliged to migrate: they are those who are unable to do so, either because of sickness or because they are forced to stay in the kaafir land, or those who are weak, such as woman and children, because Allah says (interpretation of the meaning):
“Except the weak ones among men, women and children who cannot devise a plan, nor are they able to direct their way”
[al-Nisa’ 4:98]
(c)Those for whom migration is mustahabb but not obligatory: they include those who are able to migrate but are also able to practise their religion openly in dar al-harb. It is mustahabb for such a person to migrate so that he can participate in jihad and increase the numbers of the Muslims.
In a fatwa issued by the Standing Committee (12/50): One may also migrate from a mushrik land to another mushrik land that is less evil and where there is less danger to the Muslim, as some of the Muslims migrated from Makkah at the Prophet’s command to Abyssinia. 
We ask Allah to set the Muslims’ affairs straight.