To become a Swedish citizen, you must have been living in Sweden on a long-term basis for a certain period of time. As a rule you must have been resident in Sweden for a continuous period of five years. Habitual residence means that you are a long-term resident and intend to remain in Sweden. Whether you are allowed to count all your time in Sweden as a period of habitual residence depends on why you settled here and what permit you have had during your time here. The main rule is that time with a residence permit that leads to a permanent residence permit is counted as a period of habitual residence