1. Member States shall grant long-term resident status to third-country nationals who have resided legally and continuously within its territory for five years immediately prior to the submission of the relevant application.
1a. Member States shall not grant long-term resident status on the basis of international protection in the event of the revocation of, ending of or refusal to renew international protection as laid down in Articles 14(3) and 19(3) of Directive 2004/83/EC.
2. Periods of residence for the reasons referred to in Article 3(2)(e) and (f) shall not be taken into account for the purposes of calculating the period referred to in paragraph 1.
Regarding the cases covered in Article 3(2)(a), where the third-country national concerned has acquired a title of residence which will enable him/her to be granted long-term resident status, only half of the periods of residence for study purposes or vocational training may be taken into account in the calculation of the period referred to in paragraph 1.
Regarding persons to whom international protection has been granted, at least half of the period between the date of the lodging of the application for international protection on the basis of which that international protection was granted and the date of the grant of the residence permit referred to in Article 24 of Directive 2004/83/EC, or the whole of that period if it exceeds 18 months, shall be taken into account in the calculation of the period referred to in paragraph 1.
3. Periods of absence from the territory of the Member State concerned shall not interrupt the period referred to in paragraph 1 and shall be taken into account for its calculation where they are shorter than six consecutive months and do not exceed in total 10 months within the period referred to in paragraph 1.
In cases of specific or exceptional reasons of a temporary nature and in accordance with their national law, Member States may accept that a longer period of absence than that which is referred to in the first subparagraph shall not interrupt the period referred to in paragraph 1. In such cases Member States shall not take into account the relevant period of absence in the calculation of the period referred to in paragraph 1.
By way of derogation from the second subparagraph, Member States may take into account in the calculation of the total period referred to in paragraph 1 periods of absence relating to secondment for employment purposes, including the provision of cross-border services.