Is their residing in a non-Muslim country regarded as a sin?
Question

If Muslims reside in a non-Muslim country, is that regarded as a sin? Is that the case even for Muslims who have no choice except to live in that country? I was born as a Muslim in a non-Muslim country. I grew up in America and married a Muslim man, and now I live in Australia. I give thanks to Allah, may He be glorified and exalted, Who guided me to the straight path after I was lost for several years. Now I am trying to be the best Muslim I am, and I am trying to raise my children in accordance with the Qur’an and Sunnah. I have read several times, and I have also been told, that it is not right for Muslims to live in non-Muslim countries. Please note that I did not choose to be born in a kaafir country and I want to live in a Muslim country, but I do not know how I can reach any of those countries. Everyone tells me that that is impossible. My brother is keen to study Islam in Saudi, and I have two sons and I wish I could send them to Saudi to study Islam when they are old enough to do that. All of that is only a dream right now, but I ask Allah to make it come true, if He wills. Once again, I ask: is our residing in a non-Muslim country regarded as a sin, and what should do? Should I stay where I am and learn Islam as best I can, and keep away from the disbelievers around me, or must I try to move to a Muslim country? If the answer is yes, then how can I do that?
Praise be to Allah.Firstly:
We praise Allah, may He be exalted, for having guided you to the straight path, as you say, and we ask Him, may He be glorified, to complete his blessing upon you, and to rectify your affairs and the affairs of your children and family, for He is All Hearing, Ever Responsive.
Secondly:
Undoubtedly living in a Muslim country has a good impact on a person in terms of his obedience to Allah, worship and raising his children, just as living in a non-Muslim country has a bad impact, and may even be destructive sometimes, especially for young people who grow up in that country. Overcoming this impact requires an immense effort, along with good planning, raising children properly, and cooperating with other Muslims there to create a righteous environment in which boys and girls can grow up.
It is most unfortunate that moving to Muslim countries is very difficult for many people, because of their own circumstances or because of the situation in those countries and their systems having to do with migration and settlement.
Thirdly:
Residing in a non-Muslim country may sometimes be permissible, sometimes encouraged (mustahabb) and sometimes haraam, depending on the individual’s situation, the purpose of his residing there, and the extent to which he is able to practice his religion openly. We have discussed this in answers several times, but here we will quote for you a detailed discussion by Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him), who said:
With regard to residing in the lands of the disbelievers, it poses a great danger to the Muslim’s religious commitment, morals, conduct and etiquette. We and others have seen immense deviation on the part of those who lived in those countries, then they returned different from when they went. They have come back as evildoers, and some of them have come back having apostatized from their religion, disbelieving in it and in all religions. We seek refuge with Allah. Some of them reject religion entirely, and mock the faith and its people, both the earlier and later generations. Hence it is essential , rather it is a must, to guard against that and set out some conditions and guidelines which will protect one from ruin and destruction.
There are two essential conditions that must be met before residing in a non-Muslim country:
The first condition is that the individual should be secure in terms of his faith and religious commitment, meaning that he should have sufficient knowledge, faith and strong resolve to guarantee that he will remain steadfast in his religion and will beware of deviating and going astray. He should harbour in his heart resentment towards the disbelievers, and should keep away from taking them as close friends and allies, and loving them, because taking them as close friends and allies and loving them are things that are contrary to faith. Allah, may He be exalted, says (interpretation of the meaning):
“You will not find a people who believe in Allah and the Last Day having affection for those who oppose Allah and His Messenger, even if they were their fathers or their sons or their brothers or their kindred” [al-Mujaadilah 58:22]
“O you who have believed, do not take the Jews and the Christians as allies. They are [in fact] allies of one another. And whoever is an ally to them among you - then indeed, he is [one] of them. Indeed, Allah guides not the wrongdoing people. 
So you see those in whose hearts is disease hastening into [association with] them, saying, ‘We are afraid a misfortune may strike us.’ But perhaps Allah will bring conquest or a decision from Him, and they will become, over what they have been concealing within themselves, regretful” [al-Maa’idah 5:51-52].
It is proven in as-Saheeh that the Prophet (blessings and peace of Allah be upon him) said: “Whoever loves a people is one of them” and “A man will be with those he loves.”
Loving the enemies of Allah is one of the greatest dangers to a Muslim, because loving them implies agreeing with them and following them, or at the very least not denouncing them. Hence the Prophet (blessings and peace of Allah be upon him) said: “Whoever loves a people is one of them.”
The second condition is that he should be able to practice his religion openly, meaning that he can perform the rituals of Islam without any impediment. So there should be nothing to prevent him from establishing prayer, Jumu‘ah and prayers in congregation, if there are others with him who pray in congregation and establish Jumu‘ah prayer; and he should not be prevented from giving zakaah, fasting, performing Hajj and other rituals and symbols of Islam. If he will not be able to do that, then it is not permissible for him to reside there, because in that case it becomes obligatory to migrate (hijrah) from that place.
It says in al-Mughni (vol. 8, p. 457), in a discussion listing the categories of people with regard to migration (hijrah): The first category is those for whom migration is obligatory. This refers to those who are able to migrate, and are not able to practice their religion openly or establish the obligatory duties of Islam whilst residing among the disbelievers. In this case, migration becomes obligatory, because Allah, may He be exalted, says (interpretation of the meaning):
“Indeed, those whom the angels take [in death] while wronging themselves - [the angels] will say, ‘In what [condition] were you?’ They will say, ‘We were oppressed in the land.’ The angels will say, ‘Was not the earth of Allah spacious [enough] for you to emigrate therein?’ For those, their refuge is Hell - and evil it is as a destination” [an-Nisa’ 4:97].
This is a stern warning, which indicates that migrating is obligatory in that case. Moreover, establishing the obligatory duties of Islam is obligatory for the one who is able to do that, and migrating is essential to fulfilling that obligation and completing it; whatever is it essential to carrying out an obligation is also obligatory.
End quote from Sharh al-Usool ath-Thalaathah by Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him), included in Majmoo‘ al-Fataawa (6/132).
The completion of Ibn Qudaamah’s discussion in al-Mughni is:
The second category [of people, with regard to migration] is those for whom migration is not obligatory. This refers to those who are unable to migrate, either because of sickness, or because they are compelled to stay, or because of weakness, in the case of women, children and the like. These people are not obliged to migrate, because Allah, may He be exalted, says (interpretation of the meaning):
“Except for the oppressed among men, women and children who cannot devise a plan nor are they directed to a way 
For those it is expected that Allah will pardon them, and Allah is ever Pardoning and Forgiving” [an-Nisa’ 4:98-99].
It is not regarded as being recommended (mustahabb) either, because they are not able to do it.
The third category is those for whom migration is recommended, but is not obligatory. This refers to those who are able to do it, but they are able to practice their religion openly whilst residing in the land of disbelief. It is recommended in their case, so that they may be able to strive in jihad, increase the numbers of Muslims (in the Muslim land) and support them, and stop the numbers of the kuffar from increasing, and (not) mix with them, and (not) see evils committed among them. Migration is not obligatory for them, because they are able to establish the obligatory duties of Islam without migrating.End quote from al-Mughni (9/236).
Then Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
If these two conditions are met, then residing in the land of disbelief may be divided into several categories:
The first category is residing there for the purpose of calling people to Islam and promoting it. This is a type of jihad, and it is a communal obligation for those who are able to do it, on condition that da‘wah is possible, and that there is nothing to prevent it or prevent people from responding to it, because calling people to Islam is one of the obligatory duties of the religion, and it is the way of the Messengers. The Prophet (blessings and peace of Allah be upon him) enjoined conveying the message from him in every time and place, as he (blessings and peace of Allah be upon him) said: “Convey from me, even if it is one verse.” End quote.
Hence it is known that there is the possibility that the Muslim’s residing in that country may be permissible, or even recommended, if he can practice his religion openly and call people to it; and he has sufficient Islamic knowledge to ward off doubts and specious arguments; and he takes people as friends for the sake of Allah and as enemies for the sake of Allah. But there remains the danger posed to him by the surrounding environment and its impact on him and his children. This, as noted above, requires working with other Muslims so that they will have an [Islamic] centre to call people to Islam, that is filled with remembrance of Allah, and will attract the sons and daughters of the Muslims to learn about Islam and spread guidance.
We ask Allah to help and guide you, to make you righteous and rightly guided, and to fulfil your wishes for goodness and success for your children.
And Allah knows best.