1 This request for a preliminary ruling concerns the interpretation of Article 32 of Regulation (EU) 2016/399 of the European Parliament and of the Council of 9 March 2016 on a Union Code on the rules governing the movement of persons across borders (Schengen Borders Code) (OJ 2016 L 77, p. 1) (‘Schengen Borders Code’), and of Articles 2(2)(a) and 4(4) of Directive 2008/115/EC of the European Parliament and of the Council of 16 December 2008 on common standards and procedures in Member States for returning illegally staying third-country nationals (OJ 2008 L 348, p. 98).
2 The request has been made in proceedings between the préfet des Pyrénées-Orientales (Prefect of the Pyrénées-Orientales, France) (‘the Prefect’), on the one hand, and Mr Abdelaziz Arib, the procureur de la République près le tribunal de grande instance de Montpellier (Public Prosecutor at the Regional Court, Montpellier, France) and the procureur général près la cour d’appel de Montpellier (Principal Public Prosecutor at the Court of Appeal, Montpellier), on the other hand, concerning the extension of the administrative detention of Mr Arib, who entered France illegally.
3 The Convention implementing the Schengen Agreement of 14 June 1985 between the Governments of the States of the Benelux Economic Union, the Federal Republic of Germany and the French Republic on the gradual abolition of checks at their common borders, signed in Schengen on 19 June 1990, which entered into force on 26 March 1995 (OJ 2000 L 239, p. 19) (‘the CISA’), forms part of the Schengen acquis.
4 Article 26 of the CISA reads: ‘1. The Contracting Parties undertake, subject to the obligations resulting from their accession to the Geneva Convention relating to the Status of Refugees of 28 July 1951, as amended by the New York Protocol of 31 January 1967, to incorporate the following rules into their national law: (a) If aliens are refused entry into the territory of one of the Contracting Parties, the carrier which brought them to the external border by air, sea or land shall be obliged immediately to assume responsibility for them again. At the request of the border surveillance authorities the carrier shall be obliged to return the aliens to the third State from which they were transported or to the third State which issued the travel document on which they travelled or to any other third State to which they are certain to be admitted. (b) The carrier shall be obliged to take all the necessary measures to ensure that an alien carried by air or sea is in possession of the travel documents required for entry into the territories of the Contracting Parties. 2. The Contracting Parties undertake, subject to the obligations resulting from their accession to the Geneva Convention relating to the Status of Refugees of 28 July 1951, as amended by the New York Protocol of 31 January 1967, and in accordance with their constitutional law, to impose penalties on carriers which transport aliens who do not possess the necessary travel documents by air or sea from a Third State to their territories. 3. Paragraphs 1(b) and 2 shall also apply to international carriers transporting groups overland by coach, with the exception of border traffic.’
5 Under Article 2 of the Schengen Borders Code: ‘For the purposes of this Regulation the following definitions apply: 1. “internal borders” means: (a) the common land borders, including river and lake borders, of the Member States; (b) the airports of the Member States for internal flights; (c) sea, river and lake ports of the Member States for regular internal ferry connections; 2. “external borders” means the Member States’ land borders, including river and lake borders, sea borders and their airports, river ports, sea ports and lake ports, provided that they are not internal borders; …’
6 Article 5 of the code provides: ‘1. External borders may be crossed only at border crossing points and during the fixed opening hours. The opening hours shall be clearly indicated at border crossing points which are not open 24 hours a day. Member States shall notify the list of their border crossing points to the Commission in accordance with Article 39. … 3. Without prejudice to the exceptions provided for in paragraph 2 or to their international protection obligations, Member States shall introduce penalties, in accordance with their national law, for the unauthorised crossing of external borders at places other than border crossing points or at times other than the fixed opening hours. Those penalties shall be effective, proportionate and dissuasive.’
7 Article 13(1) of the code provides: ‘The main purpose of border surveillance shall be to prevent unauthorised border crossings, to counter cross-border criminality and to take measures against persons who have crossed the border illegally. A person who has crossed a border illegally and who has no right to stay on the territory of the Member State concerned shall be apprehended and made subject to procedures respecting Directive 2008/115/EC.’
8 Under Article 14 of the Schengen Borders Code: ‘1. A third-country national who does not fulfil all the entry conditions laid down in Article 6(1) and does not belong to the categories of persons referred to in Article 6(5) shall be refused entry to the territories of the Member States. This shall be without prejudice to the application of special provisions concerning the right of asylum and to international protection or the issue of long-stay visas. … 4. The border guards shall ensure that a third-country national refused entry does not enter the territory of the Member State concerned. … 6. Detailed rules governing refusal of entry are given in Part A of Annex V.’
9 Article 23 of the code, entitled ‘Checks within the territory’, states: ‘The absence of border control at internal borders shall not affect: (a) the exercise of police powers by the competent authorities of the Member States under national law, insofar as the exercise of those powers does not have an effect equivalent to border checks; that shall also apply in border areas. Within the meaning of the first sentence, the exercise of police powers may not, in particular, be considered equivalent to the exercise of border checks when the police measures: (i) do not have border control as an objective; (ii) are based on general police information and experience regarding possible threats to public security and aim, in particular, to combat cross-border crime; (iii) are devised and executed in a manner clearly distinct from systematic checks on persons at the external borders; (iv) are carried out on the basis of spot-checks; …’
10 Article 25 of the code provides: ‘1. Where, in the area without internal border control, there is a serious threat to public policy or internal security in a Member State, that Member State may exceptionally reintroduce border control at all or specific parts of its internal borders for a limited period of up to 30 days or for the foreseeable duration of the serious threat if its duration exceeds 30 days. The scope and duration of the temporary reintroduction of border control at internal borders shall not exceed what is strictly necessary to respond to the serious threat. 2. Border control at internal borders shall only be reintroduced as a last resort, and in accordance with Articles 27, 28 and 29. The criteria referred to, respectively, in Articles 26 and 30 shall be taken into account in each case where a decision on the reintroduction of border control at internal borders is considered pursuant, respectively, to Article 27, 28 or 29. 3. If the serious threat to public policy or internal security in the Member State concerned persists beyond the period provided for in paragraph 1 of this Article, that Member State may prolong border control at its internal borders, taking account of the criteria referred to in Article 26 and in accordance with Article 27, on the same grounds as those referred to in paragraph 1 of this Article and, taking into account any new elements, for renewable periods of up to 30 days. 4. The total period during which border control is reintroduced at internal borders, including any prolongation provided for under paragraph 3 of this Article, shall not exceed six months. Where there are exceptional circumstances as referred to in Article 29, that total period may be extended to a maximum length of two years, in accordance with paragraph 1 of that Article.’
11 Article 32 of the Schengen Borders Code reads: ‘Where border control at internal borders is reintroduced, the relevant provisions of Title II shall apply mutatis mutandis.’
12 Articles 5, 13 and 14 of the code form part of Title II thereof, entitled ‘External borders’, whereas Articles 23, 25 and 32 of the code form part of Title III thereof, entitled ‘Internal borders’.
13 Under point 2 of Part A of Annex V to the Schengen Borders Code: ‘If a third-country national who has been refused entry is brought to the border by a carrier, the authority responsible locally shall: (a) order the carrier to take charge of the third-country national and transport him or her without delay to the third country from which he or she was brought, to the third country which issued the document authorising him or her to cross the border, or to any other third country where he or she is guaranteed admittance, or to find means of onward transportation in accordance with Article 26 of the [CISA] and Council Directive 2001/51/EC …; (b) pending onward transportation, take appropriate measures, in compliance with national law and having regard to local circumstances, to prevent third-country nationals who have been refused entry from entering illegally.’
14 Recital 5 of Directive 2008/115 states: ‘This Directive should establish a horizontal set of rules, applicable to all third-country nationals who do not or who no longer fulfil the conditions for entry, stay or residence in a Member State.’
15 Article 2 of the directive provides: ‘1. This Directive applies to third-country nationals staying illegally on the territory of a Member State. 2. Member States may decide not to apply this Directive to third-country nationals who: (a) are subject to a refusal of entry in accordance with Article 13 of the Schengen Borders Code, or who are apprehended or intercepted by the competent authorities in connection with the irregular crossing by land, sea or air of the external border of a Member State and who have not subsequently obtained an authorisation or a right to stay in that Member State; (b) are subject to return as a criminal law sanction or as a consequence of a criminal law sanction, according to national law, or who are the subject of extradition procedures. …’
16 Under Article 3 of the directive: ‘For the purpose of this Directive the following definitions shall apply: … (2) “illegal stay” means the presence on the territory of a Member State, of a third-country national who does not fulfil, or no longer fulfils the conditions of entry as set out in Article 5 of the Schengen Borders Code or other conditions for entry, stay or residence in that Member State; (3) “return” means the process of a third-country national going back - whether in voluntary compliance with an obligation to return, or enforced - to: - his or her country of origin, or - a country of transit in accordance with Community or bilateral readmission agreements or other arrangements; or - another third country, to which the third-country national concerned voluntarily decides to return and in which he or she will be accepted; …’
17 Article 4(4) of the directive provides: ‘With regard to third-country nationals excluded from the scope of this Directive in accordance with Article 2(2)(a), Member States shall: (a) ensure that their treatment and level of protection are no less favourable than as set out in Article 8(4) and (5) (limitations on use of coercive measures), Article 9(2)(a) (postponement of removal), Article 14(1)(b) and (d) (emergency health care and taking into account needs of vulnerable persons), and Articles 16 and 17 (detention conditions) and (b) respect the principle of non-refoulement.’
18 Under the first and second paragraphs of Article L. 621-2 of the code de l’entrée et du séjour des étrangers et du droit d’asile (Code on the entry and stay of foreign nationals and the right of asylum) as amended by Law No 2012-1560 of 31 December 2012 (‘the Ceseda’): ‘A foreign national who is not a national of a Member State of the European Union shall be liable to a sentence of one year’s imprisonment and a fine of EUR 3750: (1) if he has entered the territory of Metropolitan France without satisfying the conditions laid down in Article 5(1)(a), (b) or (c) of Regulation (EC) No 562/2006 of the European Parliament and of the Council of 15 March 2006 establishing a Community Code on the rules governing the movement of persons across borders (Schengen Borders Code) [(OJ 2006 L 105, p. 1)] and without having been admitted to that territory pursuant to Article 5(4)(a) and (c) of that regulation; the same shall apply where an alert has been issued for the purpose of refusing the foreign national entry pursuant to an enforceable decision adopted by another State party to the [CISA]; (2) or if, arriving directly from the territory of a State party to that convention, he has entered the territory of Metropolitan France without complying with the requirements of Article 19(1) or (2), Article 20(1) and Article 21(1) or (2) thereof, with the exception of the conditions referred to in Article 5(1)(e) of Regulation (EC) No 562/2006 … and in Article 5(1)(d) thereof where the alert for the purpose of refusing entry does not result from an enforceable decision adopted by another State party to the [CISA]; … For the purposes of this article, criminal proceedings may be instituted only in cases where the facts have been found in the circumstances provided for in Article 53 of the Code of Criminal Procedure.’
19 Article 53 of the code de la procédure pénale (Code of Criminal Procedure), in the version applicable to the dispute in the main proceedings, provides: ‘A crime or other offence shall be classified as in flagrante delicto where it is in the course of being committed or has just been committed. A crime or other offence shall also be so classified where, at a time very close to the act, the person suspected is pursued by hue and cry, is found in the possession of articles, or has on or about him traces or clues so as to give grounds for believing that he has taken part in the crime or other offence. Following the discovery of a crime or other offence classified as in flagrante delicto, the investigation conducted under the supervision of the public prosecutor under the conditions provided for by the present chapter may continue without interruption for eight days. Where the investigations necessary for establishing the truth in relation to a crime or other offence punishable by a term of at least five years’ imprisonment cannot be postponed, the public prosecutor may decide to extend the investigation, subject to the same conditions, by a maximum of eight days.’
20 Article 62-2 of the Code of Criminal Procedure states: ‘Police custody is a coercive measure decided upon by a senior law-enforcement officer, under the supervision of the courts, whereby a person reasonably suspected on one or more grounds of having committed or attempted to commit a crime or other offence punishable by imprisonment is held at the disposal of investigators. …’
21 Article 78-2 of Code of Criminal Procedure provides: ‘Senior law-enforcement officers and, upon their orders and under their responsibility, the law-enforcement officers and assistant law-enforcement officers referred to in Articles 20 and 21-1 may ask any person to prove his identity by any means, where one or more plausible reasons exist for suspecting that: - the person has committed or attempted to commit an offence; - or the person is preparing to commit a crime or other offence; - or the person is likely to provide information useful for the investigation in the event of a crime or other offence; - or the person has breached the obligations or prohibitions to which he is subject in the context of judicial supervision, house arrest with electronic surveillance, a sentence or a measure followed by the judge responsible for the execution of sentences; - or the person is the subject of inquiries ordered by a judicial authority. On the public prosecutor’s written recommendations for the purposes of the investigation and prosecution of offences specified by him, the identity of any person may also be checked, in accordance with the same rules, in the places and for a period of time determined by the public prosecutor. The fact that the identity check uncovers offences other than those referred to in the public prosecutor’s recommendations shall not constitute a ground for invalidating related proceedings. The identity of any person, regardless of his conduct, may also be checked pursuant to the rules set out in the first paragraph to prevent a breach of public order, in particular, an offence against the safety of persons or property. In an area between the land border of France with the States party to the [CISA] and a line drawn 20 kilometres inside that border, and in the publicly accessible areas of ports, airports and railway or bus stations open to international traffic and designated by order, for the prevention and investigation of cross-border crime, the identity of any person may also be checked, in accordance with the rules provided for in the first paragraph, in order to ascertain whether the obligations laid down by law to hold, carry and produce papers and documents are fulfilled. … Where there is a section of motorway starting in the area referred to in the first sentence of this paragraph and the first motorway tollbooth is situated beyond the 20-kilometre line, the identity check may also take place up to that first tollbooth on parking areas and on the site of that tollbooth and the adjoining parking areas. The tollbooths concerned by this provision shall be designated by order. The fact that the identity check uncovers an offence other than the non-observance of the aforementioned obligations shall not constitute a ground for invalidating related proceedings. For the purposes of this paragraph, checks related to the obligations laid down by law to hold, carry and produce papers and documents may only be carried out in any given location for a period not exceeding six consecutive hours and may not consist in systematic checks on persons present in or moving within the areas or places referred to in this paragraph. …’
22 Following the temporary reintroduction in France of border control at its common internal borders with other Member States forming part of the Schengen area, under Article 25 of the Schengen Borders Code, Mr Arib, a Moroccan national, was checked on 15 June 2016 in the area between the border of France with Spain and a line drawn 20 kilometres inside that border, under the conditions set out in the ninth paragraph of Article 78-2 of the Code of Criminal Procedure. Mr Arib, who had previously left France pursuant to a removal order notified to him on 10 August 2013, was on board a coach travelling from Morocco.
23 Mr Arib was held in police custody on suspicion of illegal entry into French territory, an offence under Article L. 621-2 of the Ceseda. The following day, the Prefect made an order against Mr Arib requiring him to leave France and ordered his administrative detention.
24 By order of 21 June 2016, the judge responsible for matters relating to liberty and detention at the tribunal de grande instance de Perpignan (Regional Court, Perpignan, France) decided to annul Mr Arib’s detention in police custody and subsequent proceedings, including his administrative detention on the ground, essentially, that it was not possible to detain him. He observed, in that respect, that Mr Arib, an illegally staying third-country national, had crossed an internal border between France and Spain, which, in his view, triggered the application of Directive 2008/115 under which no term of imprisonment can be imposed in circumstances such as those in the present case.
25 By order of 22 June 2016, the delegated magistrate at the cour d’appel de Montpellier (Court of Appeal, Montpellier, France) upheld the decision taken at first instance. The Prefect lodged an appeal in cassation against that order before the referring court, the Cour de cassation (Court of Cassation, France), submitting, inter alia, that where there is a serious threat to public policy or internal security, a Member State may exceptionally reintroduce border control at its internal borders, thus partially disapplying Directive 2008/115. According to the Prefect, since the protective measures laid down in the directive are not applicable in such a case, a person who entered France illegally may be checked in accordance with the ninth paragraph of Article 78-2 of the Code of Criminal Procedure and, by virtue of his or her illegal stay, face a term of imprisonment and, accordingly, be held in custody.
26 The referring court notes that (i) the Schengen Borders Code lays down the principle of free movement within the Schengen area and provides for the absence of internal border control between Member States, and (ii) where there is a serious threat to public policy or internal security in a Member State, the latter may nevertheless exceptionally reintroduce border control at all or specific parts of its internal borders for a limited period under Article 25 of the code.
27 The referring court also argues that, according to Article 32 of the Schengen Borders Code, where border control is reintroduced at internal borders, the relevant provisions of Title II of the code relating to external borders apply mutatis mutandis. The referring court notes, in that regard, that under Article 5(3) of the code, Member States are to introduce effective, proportionate and dissuasive penalties for the unauthorised crossing of external borders. In addition, Article 13 of the code states that the objective of border surveillance is to prevent unauthorised border crossings and to take measures against persons who have crossed the border illegally, so that a person who has crossed a border illegally and who has no right to stay on the territory of the Member State concerned is to be apprehended and made subject to procedures respecting Directive 2008/115.
28 According to the referring court, Directive 2008/115 requires Member States to issue a removal order against any third-country national illegally staying on their territory, who may be detained only to prepare his or her return or carry out the removal process in so far as no other sufficient but less coercive measures can be applied effectively. The referring court recalls the judgment of 7 June 2016, Affum (C‑47/15, EU:C:2016:408), in which the Court held that Directive 2008/115 precludes legislation of a Member State which permits a third-country national in respect of whom the return procedure established by that directive has not yet been completed to be imprisoned merely on account of illegal entry across an internal border, resulting in an illegal stay.
29 The referring court points out that, under Article L. 621-2 of the Ceseda, illegal entry into the territory is punishable by a term of imprisonment and a fine in cases of flagrante delicto.
30 In the light of that provision, the referring court asks, first, whether border control that has been reintroduced at an internal border of a Member State may be equated with border control at an external border in connection with the crossing of that border by a third-country national who does not have a right of entry, when the control is carried out in cases of flagrante delicto.
31 Should the answer to that question be in the affirmative, the referring court takes the view that the rules governing that control would have to be determined. In that regard, the referring court notes that, on the one hand, Article 2(2)(a) of Directive 2008/115 permits the Member States to continue to apply simplified national return procedures at their external borders, without having to follow all the procedural stages prescribed by the directive, in order to be able to remove more swiftly third-country nationals intercepted when crossing those borders. It points out that, on the other hand, Article 4(4) of Directive 2008/115 regulates the exercise by the Member States of the power provided for in Article 2(2)(a) thereof, given that the Member States have to observe certain minimum guarantees, which include, in particular, the conditions of detention laid down in Articles 16 and 17 of the directive.
32 The referring court therefore asks whether a State that has reintroduced border control at internal borders may rely upon Article 2(2)(a) in order to exclude from the scope of Directive 2008/115 a third-country national who crosses one such border illegally and has not yet stayed in national territory.
33 Should the answer be in the affirmative, the question then arises as to whether Article 4(4) of Directive 2008/115 is to be interpreted as not precluding the imprisonment of third-country nationals in the factual context of the present case.
34 In those circumstances, the Cour de cassation (Court of Cassation) decided to stay the proceedings and to refer the following questions to the Court for a preliminary ruling: ‘(1) Is Article 32 of [the Schengen Borders Code] - which provides that, when border control at internal borders is reintroduced, the relevant provisions of Title II (relating to external borders) are to apply mutatis mutandis - to be interpreted as meaning that border controls reintroduced at an internal border of a Member State may be equated with border controls at an external border, when that border is crossed by a third-country national who has no right of entry? (2) In the same circumstances of reintroduction of controls at internal borders, do that [code] and Directive 2008/115 … permit the application, to the situation of a third-country national crossing a border at which controls have been reintroduced, of the power, conferred on the Member States by Article 2(2)(a) of the directive, to continue to apply simplified national return procedures at their external borders? (3) Should the answer to the previous question be in the affirmative, do the provisions of Article 2(2)(a) and of Article 4(4) of the directive preclude national legislation such as Article L. 621-2 of the [Ceseda], which penalises with a term of imprisonment the illegal entry into national territory of a third-country national in respect of whom the return procedure established by that directive has not yet been completed?’
35 By its first and second questions, which should be examined together, the referring court asks, in essence, whether Article 2(2)(a) of Directive 2008/115, read in conjunction with Article 32 of the Schengen Borders Code, must be interpreted as applying to the situation of a third-country national who was apprehended in the immediate vicinity of an internal border of a Member State, where that Member State has reintroduced border control at that border, pursuant to Article 25 of the code, on account of a serious threat to public policy or internal security in that Member State.
36 As a preliminary point, it is important to note that, as mentioned in paragraphs 22 and 23 of this judgment, Mr Arib, a Moroccan national, is not subject to a refusal of entry into French territory but that he was checked by French authorities in the immediate vicinity of the border between France and Spain after border control at that border was reintroduced in accordance with Article 25 of the Schengen Borders Code, and was held in custody following that check on suspicion of having committed the offence of illegal entry into French territory set out in Article L. 621-2 of the Ceseda.
37 It should be pointed out, in that regard, first, that it follows from both the definition of the concept of ‘illegal stay’, set out in Article 3(2) of Directive 2008/115, and recital 5 of the directive, according to which the directive applies ‘to all third-country nationals who do not or who no longer fulfil the conditions for entry, stay or residence’, that a third-country national who, after entering the territory of a Member State illegally, is present on that territory without fulfilling the conditions for entry, stay or residence is, by virtue of that fact, staying there illegally, without such presence being subject to a condition requiring a minimum duration or an intention to remain on that territory (see, to that effect, judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraphs 48 and 59).
38 A third-country national who, like Mr Arib, after entering the territory of a Member State illegally is intercepted on the territory of that Member State in the immediate vicinity of one of its internal borders, without fulfilling the conditions for entry, stay or residence in that territory, must accordingly be regarded as staying illegally on the territory of that Member State.
39 A third-country national in that situation falls, under Article 2(1) of Directive 2008/115, and without prejudice to Article 2(2) of the directive, within the scope of the directive. He must therefore, in principle, be subject to the common standards and procedures laid down by the directive for the purpose of his removal, as long as his stay has not, as the case may be, been regularised (see, to that effect, judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraph 61).
40 In that respect, it should be noted, secondly, that according to the Court’s case-law, Directive 2008/115 does not preclude legislation of a Member State which permits the imprisonment of a third-country national to whom the return procedure established by the directive has been applied and who either is staying illegally on the territory of that Member State without a justified ground for non-return or has re-entered the territory in breach of an entry ban (see, to that effect, judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraphs 54 and 64).
41 It is apparent, however, from the case file before the Court and from the replies to the Court’s questions submitted at the hearing that Mr Arib does not find himself in either of the situations mentioned in the previous paragraph.
42 It must be stated, thirdly, that Article 2(2)(a) of Directive 2008/115 allows Member States not to apply the directive, without prejudice to the provisions in Article 4(4) thereof, in two particular instances, namely where third-country nationals are subject to a refusal of entry across an external border of a Member State in accordance with Article 14 of the Schengen Borders Code, or where third-country nationals are apprehended or intercepted in connection with the irregular crossing of an external border and have not subsequently obtained an authorisation or a right to stay in that Member State.
43 As set out in paragraph 36 of this judgment, Mr Arib is not subject to a refusal of entry into French territory. It follows that he cannot, in any event, fall within the first of the two situations covered by Article 2(2)(a) of Directive 2008/115.
44 Accordingly, it should be determined whether a third-country national who is staying illegally on the territory of a Member State and was apprehended in the immediate vicinity of an internal border of that Member State comes under the second situation covered by Article 2(2)(a) of Directive 2008/115, where the Member State concerned has reintroduced border control at that border on account of a serious threat to public policy or internal security in that Member State, in accordance with Article 25 of the Schengen Borders Code.
45 In that context, it must be recalled, first, that according to the Court’s case-law, the two situations covered by Article 2(2)(a) of Directive 2008/115 relate exclusively to the crossing of the external border of a Member State, as defined in Article 2 of the Schengen Borders Code, and therefore do not concern the crossing of a common border of Member States forming part of the Schengen area (judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraph 69).
46 Specifically, the second situation covered by Article 2(2)(a) of Directive 2008/115 implies a direct temporal and spatial link between the apprehension or interception of the third-country national and the crossing of an external border. That situation therefore concerns third-country nationals who have been apprehended or intercepted by the competent authorities at the very time of the irregular crossing of the border or near that border after it has been so crossed (see, to that effect, judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraph 72).
47 Accordingly, Article 2(2)(a) of Directive 2008/115 must be interpreted as not permitting Member States to exclude certain illegally staying third-country nationals from the directive’s scope on the ground of illegal entry across an internal border (judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraphs 69 and 77).
48 It should however be determined, secondly, whether the fact that border control was reintroduced by a Member State at its internal borders, in accordance with Article 25 of the Schengen Borders Code, is such as to cause the situation of a third-country national who is staying illegally on the territory of that Member State and has been apprehended near that internal border fall within Article 2(2)(a) of Directive 2008/115.
49 Article 25 of the Schengen Borders Code allows, exceptionally and under certain conditions, a Member State to reintroduce temporarily border control at all or specific parts of its internal borders where there is a serious threat to public policy or internal security in that Member State. Under Article 32 of the code, where border control at internal borders is reintroduced, the relevant provisions of the code relating to external borders are to apply mutatis mutandis.
50 In that regard, it should be noted, first, that as a derogation from the scope of Directive 2008/115, the exception in Article 2(2)(a) of the directive must be interpreted strictly.
51 It is already apparent from paragraphs 45 and 47 of this judgment that this provision, according to its own terms that are unambiguous in this respect, concerns the situation of a third-country national who finds himself at the ‘external border’ of a Member State or in the immediate vicinity of one such external border. There is no mention of the fact that the situation of a third-country national who finds himself at an internal border at which border control has been reintroduced pursuant to Article 25 of the Schengen Borders Code, or in the immediate vicinity of one such internal border, may be equated with the situation mentioned in the previous sentence, even though on the day on which the directive was adopted, Articles 23 and 28 of Regulation No 562/2006 already provided (i) that the Member States could exceptionally reintroduce border control at their internal borders where there was a serious threat to their public policy and internal security and (ii) that in such a case the relevant provisions of that regulation relating to external borders were to apply mutatis mutandis.
52 With regard, secondly, to the intended purpose of Article 2(2)(a) of Directive 2008/115, the Court has previously held that it permits the Member States, in the two situations covered by that article, to continue to apply simplified national return procedures at their external borders, without having to follow all the procedural stages prescribed by the directive, in order to be able to remove more swiftly third-country nationals intercepted in connection with the crossing of one such border (judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraph 74).
53 In that context, it should be stated that Article 2(2)(a) of Directive 2008/115 treats equally interceptions or apprehensions in the immediate vicinity of the external border of a Member State, which are covered by Article 13 of the Schengen Borders Code, and the adoption of a refusal of entry for the purpose of Article 14 of the code.
54 If indeed, as confirmed by Article 14(4) of the Schengen Borders Code, the adoption of a refusal of entry into the territory of the Schengen area aims to preclude the third-country national subject to that refusal from entering that territory, the apprehension or interception of that person, who is staying illegally, in connection with the crossing of an external border or in the immediate vicinity of one such border, also allows the competent national authorities to take the necessary measures easily and swiftly, given the place where that person was apprehended, in order to prevent that person from staying on that territory by immediately returning that person to the external border that he or she has crossed illegally.
55 In those circumstances, which are characterised, inter alia, by the vicinity to an external border, a Member State may be justified in failing to follow all the procedural stages prescribed by Directive 2008/115 in order to speed up the return to a third country of third-country nationals staying on its territory illegally.
56 Conversely, the mere reintroduction of border control at the internal borders of a Member State does not mean that an illegally staying third-country national apprehended in connection with the crossing of that border, or in the immediate vicinity thereof, may be removed more swiftly or more easily from the territory of the Schengen area by being returned immediately to an external border than if he had been apprehended in connection with a police check for the purpose of Article 23(a) of the Schengen Borders Code, in the same place, without border control having been reintroduced at those borders.
57 Contrary to the argument submitted, in essence, by the German Government, that conclusion is not called into question when account is taken of the obligations imposed on carriers under point 2 of Part A of Annex V to the Schengen Borders Code and Article 26 of the CISA.
58 Indeed, even if such obligations were, under Article 32 of the Schengen Borders Code, to apply also where border control at internal borders has been reintroduced, it should nevertheless be noted that point 2 of Part A of Annex V to the Schengen Borders Code and Article 26 of the CISA impose on carriers an obligation of onward transportation of the third-country national they are transporting only when that person has been refused entry across the border and not, as for Mr Arib, when that person is apprehended or intercepted after crossing the border illegally.
59 It follows that, in the light of the objective pursued by Article 2(2)(a) of Directive 2008/115, there is no need to treat differently the situation of an illegally staying third-country national, apprehended in the immediate vicinity of an internal border, depending on whether or not border control has been reintroduced at that border.
60 Thirdly, the need for the scope of Article 2(2)(a) of Directive 2008/115 to be interpreted restrictively is further supported by an analysis of the context of which that provision forms part and, specifically, a systematic reading of the Schengen Borders Code.
61 In this respect, the Court notes, first, that it follows from the Schengen Borders Code that an internal border at which border control has been reintroduced by a Member State under Article 25 of the code is not tantamount to an external border for the purpose of that code.
62 Under Article 2 of the Schengen Borders Code, the concepts of ‘internal borders’ and ‘external borders’ are mutually exclusive. As it is, Article 32 of the code merely provides that, where border control at internal borders is reintroduced by a Member State, only the relevant provisions of the code relating to external borders are to apply mutatis mutandis. However, Article 32 of the code does not provide, as the Advocate General has noted, in essence, in point 52 of his Opinion, that in such a case Article 2(2)(a) of Directive 2008/115 is to be applied. The very wording of the Schengen Borders Code therefore precludes, for the purposes of that directive, an internal border at which border control has been reintroduced under Article 25 of the code from being equated with an external border.
63 It is also true, as the referring court points out, that Article 5(3) of the Schengen Borders Code requires Member States to introduce effective, proportionate and dissuasive penalties for the unauthorised crossing of an external border other than at border crossing points or at times other than the fixed opening hours.
64 However, and regardless of whether that provision is a relevant provision, within the meaning of Article 32 of the Schengen Borders Code, and thus applies mutatis mutandis where border control is reintroduced by a Member State at its internal borders, the Court notes, in any event, that this provision is not in any way intended to derogate from the common standards and procedures established by Directive 2008/115, as expressly confirmed in Article 13(1) of the code, which provides that measures are to be taken against persons who have crossed an external border illegally and that, if that person has no right to stay on the territory of the Member State concerned, he or she is to be apprehended and made subject to the procedures respecting Directive 2008/115 (see, to that effect, judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraph 90).
65 Article 13(1) of the Schengen Borders Code thus explains the relationship between border surveillance and the implementation of the return procedures provided for in Directive 2008/115 (judgment of 26 July 2017, Jafari, C‑646/16, EU:C:2017:586, paragraph 69). Accordingly, the measures adopted by Member States, in particular in compliance with Article 5(3) of the Schengen Borders Code, in order to ensure effective border surveillance, cannot lead to a modification of the obligations imposed on Member States by that directive.
66 Lastly, it is important to recall that Directive 2008/115 does not prevent Member States from being able to impose a sentence of imprisonment to punish the commission of offences other than those stemming from the mere fact of illegal entry, including in situations where the return procedure established by the directive has not yet been completed (judgment of 7 June 2016, Affum, C‑47/15, EU:C:2016:408, paragraph 65). Therefore, the directive does not preclude either the apprehension or detention in custody of an illegally staying third-country national where such measures are adopted on the ground that that person is suspected of having committed an offence other than merely having entered into national territory illegally, in particular an offence that is likely to pose a threat to public policy or internal security in the Member State concerned.
67 It follows from the foregoing that the answer to the first and second questions is that Article 2(2)(a) of Directive 2008/115, read in conjunction with Article 32 of the Schengen Borders Code, must be interpreted as not applying to the situation of an illegally staying third-country national who was apprehended in the immediate vicinity of an internal border of a Member State, even where that Member State has reintroduced border control at that border, pursuant to Article 25 of the code, on account of a serious threat to public policy or internal security in that Member State.
68 In view of the answer to the first and second questions, there is no need to answer the third question.
69 Since these proceedings are, for the parties to the main proceedings, a step in the action pending before the national court, the decision on costs is a matter for that court. Costs incurred in submitting observations to the Court, other than the costs of those parties, are not recoverable.