CELEX: 62021CJ0528
Reference for a preliminary ruling
Immigration policy
Article 20 TFEU
Genuine enjoyment of the substance of the rights which flow from the status of EU citizenship
Article 47 of the Charter of Fundamental Rights of the European Union
Directive 2008/115/EC
Common standards and procedures in Member States for returning illegally staying third-country nationals
Articles 5, 11 and 13
Direct effect
Right to an effective judicial remedy
Decision banning entry and stay adopted in respect of a third-country national, a family member of a minor EU citizen
Threat to national security
Failure to take into account the individual situation of that third-country national
Refusal to comply with a court decision suspending the effects of that prohibition decision
Consequences

This request for a preliminary ruling concerns the interpretation of Article 20 TFEU, Article 47 of the Charter of Fundamental Rights of the European Union (‘the Charter’) and Articles 5, 11 and 13 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).
The request has been made in the context of a dispute between M.D. and the Országos Idegenrendészeti Főigazgatóság Budapesti és Pest Megyei Regionális Igazgatósága (Budapest and Pest Regional Directorate of the National Directorate of the Immigration Police, Hungary) (‘Immigration police authority’) concerning the legality of the decision by which that authority adopted a ban on entry and stay in respect of M.D.

Legal context

European Union law

The CISA
Article 25 of 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), as amended by Regulation (EU) No 265/2010 of the European Parliament and of the Council of 25 March 2010 (OJ 2010 L 85, p.1), (‘the CISA’) provides:
‘1.      Where a Member State considers issuing a residence permit, it shall systematically carry out a search in the Schengen Information System. Where a Member State considers issuing a residence permit to an alien for whom an alert has been issued for the purposes of refusing entry, it shall first consult the Member State issuing the alert and shall take account of its interests; the residence permit shall be issued for substantive reasons only, notably on humanitarian grounds or by reason of international commitments.
Where a residence permit is issued, the Member State issuing the alert shall withdraw the alert but may put the alien concerned on its national list of alerts.
…
2.      ‘Where it emerges that an alert for the purposes of refusing entry has been issued for an alien who holds a valid residence permit issued by one of the Contracting Parties, the Contracting Party issuing the alert shall consult the Party which issued the residence permit in order to determine whether there are sufficient reasons for withdrawing the residence permit.
If the residence permit is not withdrawn, the Contracting Party issuing the alert shall withdraw the alert but may nevertheless put the alien in question on its national list of alerts.
…’

Regulation (EC) No 1987/2006
Article 34 of Regulation (EC) No 1987/2006 of the European Parliament and of the Council of 20 December 2006, on the establishment, operation and use of the second generation Schengen Information System (SIS II) (OJ 2006 L 381, p. 4) provides:
‘1.      A Member State issuing an alert shall be responsible for ensuring that the data are accurate, up-to-date and entered in SIS II lawfully.
2.      Only the Member State issuing an alert shall be authorised to modify, add to, correct, update or delete data which it has entered.
…’

Directive 2008/115
Recitals 2, 22 and 24 of Directive 2008/115 state:
‘(2)      The Brussels European Council of 4 and 5 November 2004 called for the establishment of an effective removal and repatriation policy, based on common standards, for persons to be returned in a humane manner and with full respect for their fundamental rights and dignity.
…
(22)      In line with the 1989 United Nations Convention on the Rights of the Child, [adopted by the United Nations General Assembly on 20 November 1989,] the “best interests of the child” should be a primary consideration of Member States when implementing this Directive. In line with the European Convention for the Protection of Human Rights and Fundamental Freedoms [signed in Rome on 4 November 1950,] respect for family life should be a primary consideration of Member States when implementing this Directive.
…
(24)      This Directive respects the fundamental rights and observes the principles recognised in particular by [the Charter].’
Article 2(2) of the directive provides:
‘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.’
Article 3(3) and (6) of that directive provide:
‘For the purposes of this Directive the following definitions shall apply:
…
(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;
…
(6)      “entry ban” means an administrative or judicial decision or act prohibiting entry into and stay on the territory of the Member States for a specified period, accompanying a return decision;’
Article 5 of the same directive is worded as follows:
‘When implementing this directive, Member States shall take due account of:
(a)      the best interests of the child;
(b)      family life;
(c)      the state of health of the third-country national concerned,
and respect the principle of non-refoulement.’
Article 6 of Directive 2008/115 provides:
‘1.      Member States shall issue a return decision to any third-country national staying illegally on their territory, without prejudice to the exceptions referred to in paragraphs 2 to 5.
2.      Third-country nationals staying illegally on the territory of a Member State and holding a valid residence permit or other authorisation offering a right to stay issued by another Member State shall be required to go to the territory of that other Member State immediately. In the event of non-compliance by the third-country national concerned with this requirement, or where the third-country national’s immediate departure is required for reasons of public policy or national security, paragraph 1 shall apply.
…
6.      This Directive shall not prevent Member States from adopting a decision on the ending of a legal stay together with a return decision and/or a decision on a removal and/or entry ban in a single administrative or judicial decision or act as provided for in their national legislation, without prejudice to the procedural safeguards available under Chapter III and under other relevant provisions of Community and national law.’
Under Article 7(4) of that directive:
‘If there is a risk of absconding, or if an application for a legal stay has been dismissed as manifestly unfounded or fraudulent, or if the person concerned poses a risk to public policy, public security or national security, Member States may refrain from granting a period for voluntary departure, or may grant a period shorter than seven days.’
Article 8(1) of the directive states:
‘Member States shall take all necessary measures to enforce the return decision if no period for voluntary departure has been granted in accordance with Article 7(4) or if the obligation to return has not been complied with within the period for voluntary departure granted in accordance with Article 7.’
Article 11(1) of the same directive provides:
‘Return decisions shall be accompanied by an entry ban:
(a)      if no period for voluntary departure has been granted, or
(b)      if the obligation to return has not been complied with.
In other cases return decisions may be accompanied by an entry ban.’
Article 13(1) and (2) of Directive 2008/115 is worded as follows:
‘1.      The third-country national concerned shall be afforded an effective remedy to appeal against or seek review of decisions related to return, as referred to in Article 12(1), before a competent judicial or administrative authority or a competent body composed of members who are impartial and who enjoy safeguards of independence.
2.      The authority or body mentioned in paragraph 1 shall have the power to review decisions related to return, as referred to in Article 12(1), including the possibility of temporarily suspending their enforcement, unless a temporary suspension is already applicable under national legislation.’

Hungarian law

The Law I
Paragraph 33 of the 2007. évi I. törvény a szabad mozgás és tartózkodás jogával rendelkező személyek beutazásáról és tartózkodásáról (Law I of 2007 on the entry and residence of persons having the right of free movement and residence) of 18 December 2006 (
Magyar Közlöny
2007/1.)  (‘the Law I’), provides:
‘The right of entry and residence of persons within the scope of application of this law may be restricted, in accordance with the principle of proportionality, only on the basis of conduct of the person concerned that represents a real, immediate and serious threat to public order, national security or public health.’
Paragraph 42(1) of that law provides:
‘The expulsion in accordance with the policing of aliens cannot be ordered against a national of a Member State of the [European Economic Area (EEA)] or a member of his or her family who:
(a)      has lawfully resided for more than ten years on the territory of Hungary,
(b)      is a minor, except where the expulsion is made in the interests of the minor.’

The Law II
Paragraph 43 of the a harmadik országbeli állampolgárok beutazásáról és tartózkodásáról szóló 2007. évi II. törvény (Law No II of 2007 on the entry and stay of third-country nationals), of 18 December 2006  (
Magyar Közlöny
2007/1.)  (‘the Law II’), provides:
‘1.      The Immigration police authority shall pronounce an independent ban on entry and stay against a third country national residing in an unknown place or abroad,
(a)      with regard to whom Hungary has undertaken, under international law, to ensure compliance with the ban on entry and stay;
(b)      in respect of whom the ban on entry or stay has been pronounced by the Council of the European Union;
(c)      in respect of whom entry and stay adversely affect or endanger national security, public security or public order;
…
3.      The initiative for an independent ban on entry and stay on the ground set out in paragraph 1(c) … may also be taken by the bodies responsible for maintaining order designated by the government decree, in their own sphere of competence, with a view to achieving the tasks connected with the protection of interests defined in the law. If the independent ban on entry and stay and the expulsion under the policing of aliens are pronounced on the grounds referred to in paragraph 1(c) … the bodies responsible for maintaining order designated by the government decree, in cases affecting their tasks and competences, shall formulate a proposal as to the duration of the ban on entry and stay. The Immigration police authority cannot depart from the content of the proposal.’
Paragraph 44(1) of that law provides:
‘The duration of the independent ban on entry and stay under Paragraph 43(1)(a) and (b) shall be aligned with the duration of the obligation or the ban on which the decision is based. The duration of the independent ban on entry and stay under Paragraph 43(1)(a) and (b) shall be defined by the Immigration police authority which shall take the decision, and it shall be of a maximum duration of three years, capable of being extended if appropriate for an additional three years. The ban on entry and stay shall be immediately terminated if the ground upon which it was pronounced has disappeared.’
Under Paragraph 45(1) of that law:
‘(1)      Before adopting a decision, in accordance with the policing of aliens, expelling a third-country national who holds a residence permit owing to his or her family ties, the Immigration police authority shall take into account the following aspects:
(a)      the duration of the stay;
(b)      the age and family situation of the third-country national and the possible consequences that his or her expulsion will have for the members of his or her family;
(c)      the connections that the third-country national has with Hungary and the absence of connections with his or her country of origin.’
Paragraph 87/B(4) of that same law states:
‘The Immigration police authority seised of the case shall be bound by the opinion of the specialist authority where there is a question of the expertise concerned.’

The amending law
Paragraph 17 of the 2018. évi CXXXIII. törvény az egyes migrációs tárgyú és kapcsolódó törvények módosításáról (Law No CXXXIII of 2018 amending certain laws on migration and certain supplementary laws), of 21 December 2018 (
Magyar Közlöny
2018/208.) (‘the amending law’), entered into force on 1 January 2019. It provides:
‘The Law I is supplemented by means of Paragraph 94 as follows:
“94(1)      In proceedings relating to third-country nationals who are family members of Hungarian citizens that have started or re-started after the entry into force of [the amending law], the provisions of the Law II shall be applied.
…
(4)      The residence permit or the permanent residence permit of a third-country national who holds a valid residence permit or a permanent residence permit as a family member of a Hungarian citizen must be withdrawn.
…
(b)      If the stay of the third-country national adversely affects the public order, public security or national security of Hungary.
(5)      In questions of expertise defined in paragraph 4(b), the designated specialist authorities must be contacted, in accordance with the rules of the Law II on the issuing of a permit of establishment, with a view to requesting an expert opinion.
…’

The dispute in the main proceedings and the questions referred for a preliminary ruling
M.D. is a third-country national who arrived in Hungary in 2002. He established himself in that Member State with his mother, his partner and their minor child, born in 2016, both of whom are Hungarian nationals. Those three persons are dependants of M.D., who was working in a bakery which he was running. He has four other bakeries in Hungary and has established his company in Slovakia.
On 31 May 2003, M.D. was granted a residence permit for the Hungarian territory. That residence permit was extended on several occasions.
On 12 June 2018, M.D. made a request for a permanent residence permit, which was rejected by the Immigration police authority, ruling at first instance. As M.D. had been given a prison sentence for the offence of trafficking migrants by assisting in the unauthorised crossing of the border, that authority made a request on the subject of national security, following which the Alkotmányvédelmi Hivatal (Constitutional Protection Office, Hungary) found that M.D.’s conduct  must be regarded as a real, immediate and serious threat to national security.
By a decision of 27 August 2018, the Immigration police authority declared that M.D.’s right of residence had terminated. That decision was upheld by a decision of 26 November 2018 of the same authority, ruling at second instance. Those two decisions were based on the opinion of the Constitutionnal Protection Office referred to in the preceding paragraph.
On 3 January 2019, the Immigration police authority adopted a return decision concerning M.D. and imposed on him a ban on entry and stay of five years. That decision was however withdrawn on 18 February 2019, on the ground that it was contrary to Paragraph 42(1) of the Law I.
By a judgment of 28 May 2019, the Fővárosi Közigazgatási és Munkaügyi Bíróság (Administrative and Labour Court, Budapest, Hungary) annulled the decision of 26 November 2018 of the Immigration police authority and extended the effects of that annulment to the decision of 27 August 2018 of that authority, on the ground that the latter had not shown that the cumulative conditions laid down in Article 33 of the Law I were met, since it had based its decision on the opinion of the Constitutional Protection Office, which had not acted in the proceedings in the capacity of an specialist authority. Furthermore, the Immigration police authority had not assessed all the circumstances of the case, which it should have done even if M.D. was a real, immediate and serious threat to public security or public order. Moreover, that court ordered the same authority to assess, in the context of a new procedure, all of the circumstances of the case, and specifically the fact that M.D. and his partner had established a family life in Hungary with their minor child, a Hungarian citizen.
By a decision of 29 August 2019, following those new proceedings, the Immigration police authority withdrew M.D.’s  residence permit on the basis of an opinion of the Constitutional Protection Office and of the Pest Megyei Rendőr-főkapitányság (Principal Commissariat of the Pest Police, Hungary), according to which the personal conduct of M.D. represented a real, immediate and serious threat to national security. The Immigration police authority, ruling at second instance, upheld that decision, stressing in particular that, under Paragraph 87/B(4) of the Law II, which had been applicable since the entry into force of the amending law, it could not depart from that opinion.
The Fővárosi Törvényszék (Budapest High Court, Hungary) dismissed the appeal brought by M.D. against that decision.
The Kúria (Supreme Court, Hungary) confirmed that judgment, finding that the information given was sufficient to establish that M.D.’s residence in Hungary constituted a real and immediate threat to the national security of that Member State and that, having regard to that threat, the assessment of the personal situation of M.D. could not lead to a favourable assessment of that person’s request.
On 14 October 2020, the Immigration police authority adopted a decision banning entry and stay, for a period of three years, in respect of M.D. and entered an alert relating to that ban in the Schengen Information System (‘the SIS’).
That authority considered that, in accordance with Paragraph 94(1) of the Law I, inserted into the latter by the amending law, M.D. was within the scope of application of the Law  II. It also stated that the Constitutional Protection Office recommended the expulsion of M.D. and the adoption of a ban on entry and stay of ten years. That authority also observed that a residence permit of two years’ duration had been granted to M.D. by the Slovak authorities, with effect from 26 February 2019.
In the light of those factors, the Immigration police authority found that M.D.’s conduct represented a threat to the national security of Hungary.
The decision banning entry and stay adopted in respect of M.D., referred to in paragraph 30 of this judgment, was not preceded by the adoption of a return decision,  as M.D. had left the Hungarian territory on 24 September 2020.
Hearing an appeal brought by M.D. against that decision banning entry and stay, the referring court stresses, in the first place, that that decision, even though it had been adopted while M.D. no longer resided in Hungary, must be regarded as an entry ban  within the meaning of Article 11 of Directive 2008/115.
That court states, first, that the residence permit granted to M.D. by the Slovak authorities could not be extended, owing to the same decision and alert about M.D. in the SIS and, second, that as at the date of the present request for a preliminary ruling, M.D. resided in Austria and could not re-enter Hungary, as the Immigration police authority refused to give effect to the final order by which that court had suspended the effects of the decision at issue banning entry and stay.
The referring court observes, in the second place, that the Law I, while transposing Directive 2004/38/EC of the European Parliament and of the Council of 29 April 2004 on the right of citizens of the Union and their family members to move and reside freely within the territory of the Member States amending Regulation (EEC) No 1612/68 and repealing Directives 64/221/EEC, 68/360/EEC, 72/194/EEC, 73/148/EEC, 75/34/EEC, 75/35/EEC, 90/364/EEC, 90/365/EEC and 93/96/EEC (OJ 2004 L 158, p. 77, and corrigenda at OJ 2004 L 229, p. 35), had a scope of application which extended, inter alia, to third-country nationals who were family members of a Hungarian national, and who had not exercised their right to free movement. Thus, that law permitted those third-country nationals to reside in Hungary under the same conditions as third-country nationals who are family members of nationals of EEA Member States who have exercised their right to free movement.  However, the amending law, which entered into force on 1 January 2019, excluded third-country nationals who were family members of a Hungarian national from the scope of application of the Law I, and made the Law  II applicable to their entry and stay, which, until now, governed only the entry and stay of third-country nationals who were not family members of a national of an EEA Member State.
In accordance with Paragraph 17 of that amending law, the Law II is also applicable to proceedings which, as in the present case, were recommenced after the entry into force of the amending law.  Under the Law II, the residence permit or permanent residence permit of a third-country national could be withdrawn more easily than under the Law I, in particular in a case in which the conduct of that third-country national adversely affected public order, public security or national security in Hungary. Accordingly, in such a case, the expulsion of the third-country national concerned must be ordered, without the family or personal circumstances of that national being taken into consideration.
The referring court observes, inter alia, that, by its judgment of 11 March 2021
, État belge (Return of the parent of a minor)
(C‑112/20, EU:C:2021:197), the Court held that Article 5 of Directive 2008/115, read in conjunction with Article 24 of the Charter, requires Member States to take due account of the best interests of the child before adopting a return decision accompanied by an entry ban, even where the person to whom that decision is addressed is not a minor but his or her father.
The referring court stresses, in the third place, that the Hungarian nationals who are members of M.D.’s family, have not exercised their right to free movement within the European Union and that, consequently, M.D. may not base his derived right of residence on either Directive 2004/38 or Article 21 TFEU.
That court makes the observation, however, that in the event of the immediate enforcement of the expulsion of a third-country national ordered for reasons of national security, family members of that national who have, as in the present case, EU citizenship, must also leave the Hungarian territory as the family unit would otherwise be permanently ruptured, given that the ground connected with national security also precludes the issuing of a visa. The referring court recalls that a refusal to grant a right of residence to a third-country national is liable to undermine the effectiveness of EU citizenship if there exists, between that third-country national and the EU citizen who is a family member, a relationship of dependency of such a nature that it would lead to the EU citizen being compelled to accompany the third-country national concerned, who is his or her family member, and to leave the territory of the European Union.
The referring court considers that there is no provision of Hungarian law that provides that the personal and family circumstances must be examined before adopting a decision to ban entry and stay for third-country nationals that do not hold a right of residence. M.D. is thus in a situation less favourable not only than that of third-country nationals who are family members of an  EU citizen who has exercised his or her right to free movement, but also than that of third-country nationals who are not family members of an  EU citizen, the situation of those third-country nationals being governed by the directives transposed by the Law  II, but which do not apply to third-country nationals who, like M.D., are family members of an  EU  citizen.
In the fourth place, the referring court wonders whether, on the hypothesis that the new Hungarian legislation is incompatible with EU law and in the absence of another specific national law, it may take into account Paragraph 42(1) of the Law I, which applied to M.D. until 1 January 2019, or whether it may disapply national law and base its decision directly on Directive 2008/115.
Finally, the referring court considers that there is no case-law of the Court as to the refusal of the Immigration Police Authority to give effect to an order such as that by which it ordered the suspension of the decision banning entry and stay adopted in respect of M.D., referred to in paragraph 30 of this judgment.
In those circumstances, the Fővárosi Törvényszék (Budapest High Court) decided to stay the proceedings and to refer the following questions to the Court of Justice for a preliminary ruling:
‘(1)      Are Articles 5 and 11 of Directive 2008/115 and Article 20 TFEU, in conjunction with Articles 7, 20, 24 and 47 of the Charter, to be interpreted as precluding a practice of a Member State which extends the application of a legislative amendment to fresh proceedings initiated by virtue of a court order made in previous proceedings, where, as a result of that legislative amendment, a third-country national who is a family member of a Union citizen is made subject to much less favourable procedural rules, such that that person loses the status of a person who may not be returned even on grounds of public policy, public safety or national security, which that person had attained on account of the duration of his residence up to that point; that person’s application for a permanent residence card is then refused on the basis of that factual situation and on grounds of national security; and that person has the residence card issued in his favour withdrawn and is subsequently made subject to an entry and residence ban without consideration of his personal and family circumstances in any of the proceedings (particularly, in this context, the fact that the person concerned also has a dependent minor child who is a Hungarian citizen), as a result of which either the family unit is broken up or the Union citizens who are family members of the third-country national, including his minor child, are required to leave the territory of the Member State?
(2)      Are Articles 5 and 11 of Directive 2008/115 and Article 20 TFEU, in conjunction with Articles 7 and 24 of the Charter, to be interpreted as precluding a practice of a Member State pursuant to which the personal and family circumstances of a third-country national are not examined before the imposition on that third-country national of an entry and residence ban, on the grounds that residence by that person, who is a family member of a Union citizen, presents a real, immediate and serious threat to the country’s national security?
In the event of an affirmative answer to the first and second questions:
(3)      Are Article 20 TFEU and Articles 5 and 13 of Directive [2008/115], in conjunction with Articles 20 and 47 of the Charter, and recital 22 of Directive 2008/115, which states that the obligation to take into account the best interests of the child should be a primary consideration, and recital 24 of that directive, which requires that the fundamental rights and principles enshrined in the Charter must be guaranteed, to be interpreted as meaning that, where, in the event that the national court declares, on the basis of a ruling of the Court of Justice of the European Union, that the law of the Member State or the practices of the immigration authorities based on that law are contrary to EU law, that court may, when examining the legal basis of the entry and residence ban, take into account, as an acquired right of the applicant in the present case, the fact that, under the rules of [the Law I], the applicant had achieved what was necessary for the purposes of application of Article 42 of that Law, namely more than 10 years’ legal residence in Hungary, or, when reviewing the grounds for the issue of the entry and residence ban, must that court base the consideration taken of family and personal circumstances directly on Article 5 of Directive 2008/115 in the absence of provisions in that respect in [the Law II]?
(4)      Is a practice of a Member State whereby, in proceedings brought by a third-country national who is a family member of an EU citizen, exercising his right of appeal, the immigration authorities do not comply with a final decision of a court which orders immediate judicial protection against the enforcement of the decision [of those authorities] who claim that they have already entered in the [SIS II] a description relating to the entry and residence ban, as a consequence of which the third-country national who is a family member of an EU citizen is not entitled to exercise in person the right of appeal or to enter Hungary while the proceedings are in progress before a final judgment has been given in his case, compatible with EU law, in particular with the right to an effective remedy guaranteed in Article 13 of Directive 2008/115 and with the right to a fair trial enshrined in Article 47 of the Charter?’

Procedure before the Court
The referring court requested that the present case be dealt with under the urgent preliminary-ruling procedure provided for in Article 107 of the Rules of Procedure of the Court.
By a decision of 16 September 2021, the Fifth Chamber decided, acting on a proposal from the Judge-Rapporteur and after hearing the Advocate General, that it was not appropriate to grant that request to apply the urgent preliminary ruling procedure.
On 1 October 2021, the President of the Court decided that that case would be given priority, pursuant to Article 53(3) of the Rules of Procedure of the Court.

Consideration of the questions referred

Admissibility
According to the Hungarian Government, the questions referred for a preliminary ruling should be declared inadmissible to the extent that they seek, first, a determination as to whether EU law precludes the withdrawal of M.D.’s right of residence on Hungarian territory, even though that withdrawal is not the subject matter of the proceedings pending before the referring court and, second, an interpretation of Directive 2008/115, even though the decision at issue in the main proceedings banning entry and stay does not fall within the scope of application of that directive since it was adopted after M.D. had left the Hungarian territory.
In that regard, it is clear from the Court’s settled case-law that questions on the interpretation of EU law referred by a national court, in the factual and legislative context which that court is responsible for defining, and the accuracy of which is not a matter for the Court to determine, enjoy a presumption of relevance. The Court may refuse to rule on a question referred for a preliminary ruling from a national court only where it is quite obvious that the interpretation of EU law sought bears no relation to the actual facts of the main action or its purpose, where the problem is hypothetical, or where the Court does not have before it the factual or legal material necessary to give a useful answer to the questions submitted to it (judgment of 8 November 2022
Staatssecretaris van Justitie en Veiligheid and X (Ex officio review of detention)
, C‑704/20 and C‑39/21, EU:C:2022:858, paragraph 61 and the case-law cited).
In the present case, it is clear from the request for a preliminary ruling and the answer given by the referring court to the information request which was sent to it, first, that that court is called upon to review only the lawfulness of the decision banning entry and stay adopted in respect of M.D., as the decision which withdrew the right of residence of that third-country national on the Hungarian territory has become final and, second, that that ban on entry and stay applies in respect of the whole of the territory of the European Union.
It follows that, as the Hungarian Government submits, the questions referred are useful for the resolution of the dispute in the main proceedings only to the extent that they concern the decision banning entry and stay of which M.D. was the subject and that, therefore, they are admissible only to that extent.
As regards, by contrast, the usefulness of interpreting Directive 2008/115 in the context of the main proceedings, it must be recalled that, where, as in the present case, it is not obvious that the interpretation of a provision of  EU law bears no relation to the facts of the main action or its purpose, the objection alleging the inapplicability of that provision to the case in the main action does not relate to the admissibility of the request for a preliminary ruling, but concerns the substance of the questions  (see, to that effect, judgment of 14 July 2022,
ASADE
, C‑436/20, EU:C:2022:559, paragraph 41 and the case-law cited).

Substance

The first and second questions
By its first and second questions, which it is appropriate to examine together, the referring court asks, in essence, whether Article 20 TFEU and Articles 5 and 11 of Directive 2008/115, read in conjunction with Articles 7, 20, 24 and 47 of the Charter, must be interpreted as precluding a Member State from adopting a decision banning entry into European Union territory in respect of a third-country national who is a family member of a Union citizen, a national of that Member State who has never exercised his or her right to free movement, on the ground that the conduct of that third-country national constitutes a real, immediate and serious threat to the national security of that Member State, without examining the personal and family situation of that third-country national.
As a preliminary matter it should be observed that, according to the Hungarian Government, the applicable Hungarian legislation permits consideration to be given, in a situation such as that at issue in the main proceedings, to the personal and family situation of the third-country national before a decision to ban entry into the territory of the European Union is adopted in respect of him or her.
However, as recalled in paragraph 49 of this judgment, the questions relating to the interpretation of EU law are referred by the national court in the factual and legal context which that court is responsible for defining, the accuracy of which is not a matter for the Court to determine.  Consequently, a reference for a preliminary ruling must be examined in the light of the interpretation of national law provided by the referring court and not that relied on by the government of a Member State (judgment of 20 October 2022,
Centre public d’action sociale de Liège (Withdrawal or suspension of a return decision)
,  C‑825/21, EU:C:2022:810, paragraph 35).
It follows that the first and second questions must be answered on the basis of the premiss, which it is nevertheless for the referring court to verify, that the national law does not permit consideration to be given, in a situation such as that at issue in the main proceedings, to the personal and family situation of the third-country national concerned before adopting, in respect of him or her, a decision banning entry into the territory of the European Union.
–
Article 20 TFEU
In the first place, it should be recalled that Article 20 TFEU precludes national measures which have the effect of depriving  Union citizens of the genuine enjoyment of the substance of the rights conferred by virtue of their status as Union citizens (judgments of 8 March 2011,
Ruiz Zambrano
, C‑34/09, EU:C:2011:124, paragraph 42, and 27 February 2020,
Subdelegación del Gobierno en Ciudad Real (Spouse of a Union citizen
) (C‑836/18, EU:C:2020:119, paragraph 37).
In that regard, the Court has already held that there are very specific situations in which, despite the fact that secondary law on the right of residence of third-country nationals does not apply and the Union citizen concerned has not made use of freedom of movement, a right of residence must nevertheless be granted to a third-country national who is a family member of that Union citizen, since the effectiveness of Union citizenship would otherwise be undermined if, as a consequence of refusal of such a right, that citizen would be obliged in practice to leave the territory of the European Union as a whole, thus depriving him or her of the genuine enjoyment of the substance of the rights conferred by that status (see, to that effect, the judgments of 8 March 2011,
Ruiz Zambrano
, C‑34/09, EU:C:2011:124, paragraphs 43 and 44, and of 5 May 2022,
Subdelegación del Gobierno en Toledo (Residence of a family member
–
Insufficient resources)
, C‑451/19 and C‑532/19, EU:C:2022:354, paragraph 45).
However, a refusal to grant a right of residence to a third-country national is liable to undermine the effectiveness of Union citizenship only if there exists, between that third-country national and the Union citizen who is a family member, a relationship of dependency of such a nature that it would lead to the Union citizen being compelled to accompany the third-country national concerned and to leave the territory of the European Union as a whole (judgments of 8 May 2018,
K.A. and Others (Family reunification in Belgium)
, C‑82/16, EU:C:2018:308, paragraph 52, and of 5 May 2022,
Subdelegación del Gobierno en Toledo (Residence of a family member
–
Insufficient resources)
, C‑451/19 and C‑532/19, EU:C:2022:354, paragraph 46 and the case-law cited).
In the second place, in the same way as a refusal or loss of a right of residence on the territory of a Member State, a ban on entry into the territory of the European Union, imposed on a third-country national who is a family member of a Union citizen, could lead to depriving that citizen of the genuine enjoyment of the substance of the rights which that status confers upon him or her, where, owing to the relationship of dependency between those persons, that entry ban compels, de facto, that citizen to leave the territory of the European Union as a whole, in order to go with the member of his or her family, the third-country national who is the subject of that ban (see, by analogy, judgment of 13 September 2016,
CS
, C‑304/14, EU:C:2016:674, paragraph 32).
In the present case, the minor child of M.D, and the child’s mother, enjoy, as citizens of the European Union, the rights enshrined in Article 20 TFEU. Therefore, it cannot a priori be excluded that the ban on entry and stay imposed on M.D. would lead to those Union citizens being, de facto, deprived of the genuine enjoyment of the substance of the rights which they derive from their status as Union citizens. That would be the case if there was, between M.D. and his minor child and his partner, a relationship of dependency for the purposes of Article 20 TFEU, as it has been interpreted by the Court, which would compel, de facto, that minor child and that partner themselves also to leave the territory of the European Union (see, inter alia, the judgments of 8 May 2018,
K.A. and Others (Family reunification in Belgium)
, C‑82/16, EU:C:2018:308, paragraphs 65 and 71 to 75, and 5 May 2022,
Subdelegación del Gobierno en Toledo (Residence of a family member
–
Insufficient resources)
, C‑451/19 and C‑532/19, EU:C:2022:354, paragraphs 56 and 64 to 69).
In that regard, it must be recalled that, according to the referring court, M.D. held a right of residence in Slovakia at the date on which his permit to reside on Hungarian territory was withdrawn.  Therefore, that withdrawal does not appear to have been capable of compelling, de facto, M.D.’s minor child and his partner, the mother of that child, to leave the territory of the European Union as a whole, as there is nothing to indicate that it was impossible for those Union citizens to reside legally in Slovakia.
On the basis of the information available to the Court, it is not therefore certain that the withdrawal of M.D.’s residence permit by the Hungarian authorities could have infringed Article 20 TFEU (see, by analogy, judgment of 10 October 2013,
Alokpa and Moudoulou
, C‑86/12, EU:C:2013:645, paragraphs 34 and 35).
However, by adopting the decision banning entry and stay at issue in the main proceedings, the effects of which have a European dimension, the Hungarian authorities have deprived M.D. of any right to reside in the territory of all of the Member States  (see, to that effect, judgment of 16 January 2018,
E
, C‑240/17, EU:C:2018:8, paragraph 42).
It follows from the foregoing considerations that a Member State cannot ban entry into the territory of the European Union of a third-country national of whom a family member is a Union citizen, a national of that Member State who has never exercised his or her right to free movement, without having ascertained whether there is a relationship of dependency, as described in paragraph 61 of this judgment, between that third-country national and that family member. On the contrary, it is for the competent national authorities  to assess, inter alia, on the basis of the evidence which the third-country national and the Union citizen concerned must be free to provide and, if necessary, by carrying out the necessary investigations, whether there is a relationship of dependency between those two persons (see, to that effect, the judgment of 27 February 2020,
Subdelegación del Gobierno en Ciudad Real (Spouse of a Union citizen)
, C‑836/18, EU:C:2020:119, paragraph 53).
In the third place, it should be observed that M.D. was deprived of his right of residence on Hungarian territory on the ground that his conduct constituted a real, immediate and serious threat to national security and the adoption of the decision banning his entry and stay in European Union territory was based on the same ground.
To that extent, it must be recalled that the Member States may derogate, under certain conditions, from the derived right of residence, flowing from Article 20 TFEU, for a family member of a Union citizen referred to in paragraph 58 of this judgment, in order to maintain public order or safeguard public security. That may be the case where the third-country national represents a real, immediate and sufficiently serious threat to public order or public or national security (see, to that effect, judgment of 8 May 2018,
K.A. and Others (Family reunification in Belgium)
, C‑82/16, EU:C:2018:308, paragraph 92 and the case-law cited).
However, as the Advocate General observed in point 103 of his Opinion, the application of that derogation cannot be based solely on the criminal record of the third-country national concerned. It can result, where appropriate, only from a specific assessment of all the relevant circumstances of the case, in the light of the principle of proportionality, the fundamental rights whose observance the Court ensures and, inter alia, the best interests of the minor child, who is a Union citizen. Thus, the competent national authority may take into consideration, inter alia, the gravity of the offences committed and the degree of severity of those convictions, as well as the period between the date on which they are handed down and the date on which that authority gives its decision. Where the relationship of dependency between that third-country national and a Union citizen who is a minor stems from the fact that the former is the parent of the latter, account must also be taken of the age and state of health, as well as the family and economic situation of that minor Union citizen  (see, to that effect, the judgment of 5 May 2022,
Subdelegación del Gobierno en Toledo (Residence of a family member
–
Insufficient resources)
, C‑451/19 and C‑532/19, EU:C:2022:354, paragraph 53 and the case-law cited).
Therefore, where it is established that there is a relationship of dependency, as described in paragraph 61 of this judgment, between the third-country national concerned and the member of his or her family, who is a Union citizen, the Member State concerned may ban entry and stay in European Union territory of that national for reasons of public order or national security only after having taken into account all the relevant circumstances and, in particular, where appropriate, the best interests of the minor child, who is a Union citizen.
It follows from all of the foregoing considerations that Article 20 TFEU precludes a Member State from adopting a decision banning entry and stay in the territory of the European Union in respect of a third-country national, who is a family member of a Union citizen, a national of that Member State who has never exercised his or her right of free movement, without having examined beforehand whether there is, between those persons, a relationship of dependency which would de facto compel that Union citizen to leave the territory of the European Union altogether in order to go with that family member, and, if so, whether the grounds on which that decision was adopted allow a derogation from the derived right of residence of that third-country national.
–
Directive 2008/115
In the first place, it is appropriate to examine whether a decision, taken by a Member State, to ban entry into the territory of the European Union as a whole in respect of a third-country national falls within the scope of application of Directive 2008/115 where, as in the present case, that decision is taken after that national has left the territory of that Member State without any return decision having been adopted concerning that person.
In that regard, first, it is clear from recital 2 of Directive 2008/115 that that directive called for the establishment of an effective removal and repatriation policy, based on common standards, for persons to be returned in a humane manner and with full respect for their fundamental rights and dignity. As is apparent from both its title and Article 1 thereof, that directive establishes for that purpose ‘common standards and procedures’ which must be applied by each Member State for returning illegally staying third-country nationals (judgment of 8 May 2018,
K.A. and Others (Family reunification in Belgium)
, C‑82/16, EU:C:2018:308, paragraph 100 and the case-law cited).
Subject to the exceptions laid down in Article 2(2) of Directive 2008/115, which do not appear to apply in a situation such as that at issue in the main proceedings, that directive applies to any third-country national staying illegally in the territory of a Member State. Moreover, where a third-country national falls within the scope of that directive, he or she must therefore, in principle, be subject to the common standards and procedures laid down by that directive for the purpose of his or her removal, as long as his or her stay has not, as the case may be, been regularised (judgment of 22 November 2022,
Staatssecretaris van Justitie en Veiligheid (Removal – Medicinal cannabis
), C‑69/21, EU:C:2022:913, paragraph 52 and the case-law cited).
Article 6(1) of Directive 2008/115 provides that, once the unlawful nature of residence has been established, any third-country national must, without prejudice to the exceptions provided for in paragraphs 2 to 5 of that article and in strict compliance with the requirements laid down in Article 5 of that directive, be the subject of a return decision, which must identify, among the third countries referred to in Article 3(3) of that Directive, the country to which the third-country national must return (judgment of 22 November 2022,
Staatssecretaris van Justitie en Veiligheid (Removal
–
Medicinal cannabis)
, C‑69/21, EU:C:2022:913, paragraph 53 and the case-law cited).
It is clear, however, from Article 6(2) of Directive 2008/115 that a third-country national staying illegally in the territory of a Member State whilst having a right of residence in another Member State should be allowed to return to the latter, rather than be issued a return decision from the outset, unless public policy or national security so requires (judgment of 24 February 2021,
M and Others (Transfer to a Member State)
, C‑673/19, EU:C:2021:127, paragraph 35).
Finally, under Article 11(1) of Directive 2008/115, Member States must impose an entry ban where a third-country national who has been the subject of a return decision has not complied with his or her obligation to return or where no period for voluntary departure was granted to him or her, which may be the case, in accordance with Article 7(4) of that directive, where the person concerned represents a risk to public policy, public security or national security (judgment of 8 May 2018,
K.A. and Others (Family reunification in Belgium)
, C‑82/16, EU:C:2018:308, paragraph 86). In other situations, it follows from Article 11(1) that Member States may issue a return decision accompanied by an entry ban.
It is clear from the case-law of the Court that an entry ban constitutes a means of increasing the effectiveness of the European Union’s return policy by ensuring that, for a certain period after the removal of a third-country national who was staying illegally, that person can no longer lawfully return to the territory of the Member States (judgment of 17 September 2020,
JZ (Custodial sentence in the case of an entry ban)
, C‑806/18, EU:C:2020:724, paragraph 32).
Secondly, the fact that, as in the present case, a third-country national is the subject of an entry ban decision without  beforehand having been the addressee of a return decision does not necessarily mean that that entry ban decision is outside the scope of Directive 2008/115.
Admittedly, it follows from Article 3(6) and Article 11(1) of Directive 2008/115 that, as a rule, the adoption of an entry ban decision in respect of a third-country national is not conceived of without a return decision having been adopted in respect of that national.
However, in the present case, it is clear from the order for reference that the decision by which Hungary prohibited M.D. from entering the territory of the European Union, on the ground that his conduct constituted a real, immediate and serious threat to the national security of that Member State was adopted as an extension of the decision by which that Member State had withdrawn from him, on an identical ground, the right to reside in the territory of that same Member State.
It is clear from the very wording of Article 6(2) of Directive 2008/115 that, in such a case, the Member State in which the third-country national illegally resides is required to adopt a return decision in his or her respect, even where the latter holds a right of residence in another Member State (see, to that effect, judgment of 16 January 2018,
E
, C‑240/17, EU:C:2018:8, paragraph 48).
In that regard, it is irrelevant that, as the Hungarian Government submitted, the lack of a return decision is explained, in this case, by the complexity of the decision-making process provided for under the national legislation. According to the Court’s consistent case-law, a Member State may not rely on provisions, practices or situations of its internal legal order in order to justify non‑compliance with its obligations under EU law (judgments of 8 September 2010,
Carmen Media Group
, C‑46/08, EU:C:2010:505, paragraph 69 and of 25 February 2021,
Commission v Spain (Personal Data Directive
–
Criminal law)
, C‑658/19, EU:C:2021:138, paragraph 19 and the case-law cited).
Therefore, it would be contrary to the aim and the general scheme of Directive 2008/115 to find that a decision banning entry into the territory of the European Union adopted in respect of a third-country national on a ground of safeguarding national security falls outside the scope of that directive owing to the fact that that third-country national was not the subject, beforehand, of a return decision.
To find in such a case that Directive 2008/115 does not apply to that entry ban decision would unduly deprive that third-country national from the substantive and procedural safeguards that the Member States are required to comply with pursuant to that directive when they contemplate adopting such an entry ban decision.
That conclusion is not called into question by the judgment of 3 June 2021,
Westerwaldkreis
, (C‑546/19, EU:C:2021:432), since the situation at issue in the case that gave rise to that judgment is different from that at issue in the main proceedings. The entry ban decision at issue in that judgment had been maintained even though the return decision, to which that entry ban decision was attached, had been withdrawn.
Thirdly, the fact that, at the date on which a decision banning entry and stay was adopted in respect of a third-country national, the latter was no longer unlawfully residing in the territory of the Member State that adopted that decision also does not suffice to exclude that decision from the scope of Directive 2008/115.
First, as has been observed in paragraph 77 of this judgment, such a decision banning entry and stay has the aim of preventing the third-country national concerned from returning to European Union territory after he or she has left it.  Second, while Article 6(6) of Directive 2008/115 allows a return decision and an entry ban decision to be adopted concomitantly, that provision does not require it. Therefore, the fact that an entry ban decision is adopted after the third-country national has left the territory of a Member State does not suffice for that entry ban decision automatically to escape the scope of application of that directive.
It must therefore be held that an entry ban decision, such as that at issue in the main proceedings, must be regarded as an entry ban, within the meaning of Article 11 of Directive 2008/115, and that its adoption is subject to compliance with the safeguards laid down by that directive.
In the second place, Article 5 of Directive 2008/115, which is a general rule binding on the Member States as soon as they implement that directive (judgment of 22 November 2022,
Staatssecretaris van Justitie en Veiligheid (Removal
–
Medical Cannabis)
, C‑69/21, EU:C:2022:913, paragraph 55), obliges them to take due account of the best interests of the child, of the family life and of the state of health of the third-country national concerned. Therefore, that obligation is also binding on them when they contemplate adopting an entry ban decision, within the meaning of Article 11 of that directive.
It must also be stated that, under that Article 5, Member States are required to take due account of the best interests of the child before adopting an entry ban decision, even where the person to whom that decision is addressed is not a minor but his or her father (see, to that effect, the judgment of 11 March 2021,
État belge (Return of the parent of a minor)
, C‑112/20, EU:C:2021:197, paragraph 43).
Therefore, that Article 5 precludes the adoption of an entry ban decision, within the meaning of Article 11 of Directive 2008/115, in respect of a third-country national without consideration being given, beforehand, to his or her state of health and, where appropriate, his or her family life and the best interests of his or her minor child.
It follows from all the foregoing considerations that the answer to the first and second questions is as follows:
–        Article 20 TFEU must be interpreted as precluding a Member State from adopting a decision banning entry into the territory of the European Union in respect of a third-country national, who is a family member of a Union citizen, a national of that Member State who has never exercised his or her right to free movement, without having examined beforehand whether there is, between those persons, a relationship of dependency which would de facto compel that Union citizen to leave the territory of the European Union altogether in order to go with that family member and, if so, whether the grounds on which that decision was adopted allow a derogation from the derived right of residence of that third-country national;
–        Article 5 of Directive 2008/115 must be interpreted as precluding that a third-country national, who should have been the addressee of a return decision, may be the subject – in a direct extension of the decision which withdrew from him or her, for reasons connected with national security, his or her right of residence in the territory of the Member State concerned – of a decision banning entry into the territory of the European Union, adopted for identical reasons, without consideration being given, beforehand, to his or her state of health and, where appropriate, his or her family life and the best interests of his or her minor child.

The third question
By its third question, the referring court asks, in essence, whether Article 20 TFEU and Articles 5 and 13 of Directive 2008/115, read in conjunction with Articles 20 and 47 of the Charter, must be interpreted as meaning that, where a national court is seised of an action against an entry ban  decision adopted pursuant to national legislation that is incompatible with that Article 5, that court may base its decision on earlier national legislation or is required to apply that Article 5 directly.
In the first place, it follows from the settled case-law of the Court that, whenever the provisions of a directive appear, so far as their subject matter is concerned, to be unconditional and sufficiently precise, they may be relied upon before the national courts by individuals against the State where the latter has failed to implement the directive in domestic law by the end of the period prescribed or where it has failed to implement the directive correctly (judgments of 5 October 2004,
Pfeiffer and Others
, C‑397/01 to C‑493/01, EU:C:2004:584, paragraph 103, and of 8 March 2022,
Bezirkshauptmannschaft Hartberg-Fürstenfeld (Direct effect)
, C‑205/20, EU:C:2022:168, paragraph 17 and the case-law cited).
A provision of EU law is, first, unconditional where it sets forth an obligation which is neither qualified by any condition nor subject, in its implementation or effects, to the taking of any measure either by the institutions of the European Union or by the Member States and, second, sufficiently precise to be relied on by an individual and applied by a court where it sets out an obligation in unequivocal terms. Furthermore, even though a directive leaves the Member States a degree of latitude when they adopt rules in order to implement it, a provision of that directive may be regarded as unconditional and precise where it imposes on Member States in unequivocal terms a precise obligation as to the result to be achieved, which is not coupled with any condition regarding application of the rule laid down by it (judgments of 19 January 1982,
Becker
, 8/81, EU:C:1982:7, paragraph 25, and of 8 March 2022,
Bezirkshauptmannschaft Hartberg-Fürstenfeld (Direct effect)
, C‑205/20, EU:C:2022:168, paragraphs 18 and 19 and the case-law cited).
In the present case, the referring court’s question rests on the premiss that the Hungarian legislature disregarded the safeguards laid down in Article 5 of Directive 2008/115 by not requiring the competent national authority to take due account of the state of health of the third-country national concerned and, where appropriate, his or her family life and the best interests of his or her child, before adopting, in respect of that national, an entry ban on grounds connected with national security.
In that regard, it should be observed that, in its requirement that Member States take due account of those factors when implementing that directive, Article 5 of Directive 2008/115 is sufficiently precise and unconditional to be regarded as having direct effect.  That article may therefore be relied on by an individual and applied by the administrative authorities and by the courts of Member States.
In particular, where a Member State exceeds its discretion by adopting national legislation that does not guarantee that the competent national authority will take due account of the state of health of the third-country national concerned and, where appropriate, his or her family life and the best interests of his or her child, that national must be able to invoke directly Article 5 of that directive against such legislation (see, by analogy, judgment of 8 March 2022,
Bezirkshauptmannschaft Hartberg-Fürstenfeld (Direct effect)
, C‑205/20, EU:C:2022:168, paragraph 30).
In the second place, it should be recalled that, in order to ensure the effectiveness of all provisions of EU law, the primacy principle requires, inter alia, national courts to interpret, to the greatest extent possible, their national law in conformity with EU law. However, the obligation to interpret national law consistently with EU law cannot serve as a basis for an interpretation of national law contra legem (judgments of 16 June 2005,
Pupino
, C‑105/03, EU:C:2005:386, paragraph 47, and of 8 March 2022,
Bezirkshauptmannschaft Hartberg-Fürstenfeld (Direct effect),
C‑205/20,

EU:C:2022:168, paragraphs 35 and 36, and the case-law cited).
It should also be borne in mind that the principle of primacy places the national court which is called upon within the exercise of its jurisdiction to apply provisions of EU law under a duty, where it is unable to interpret national legislation in compliance with the requirements of EU law, to give full effect to the requirements of that law in the dispute before it, if necessary disapplying of its own motion any national legislation or practice, even if adopted subsequently, which is contrary to a provision of EU law with direct effect, and it is not necessary for that court to request or await the prior setting aside of such national legislation or practice by legislative or other constitutional means (see, to that effect, judgments of 24 June 2019,
Popławski
, C‑573/17, EU:C:2019:530, paragraphs 58 and 61, and of 8 March 2022,
Bezirkshauptmannschaft Hartberg-Fürstenfeld (Effet direct)
, C‑205/20, EU:C:2022:168, paragraph 37 and the case-law cited).
Consequently, where Article 5 of Directive 2008/115 is invoked by an individual before a national court against a Member State which has transposed it incorrectly, it is for that court to ensure the full effectiveness of that directly effective EU law provision and, if it is unable to interpret the national legislation in conformity with that Article 5, to disapply, of its own motion, the national provisions which appear to be incompatible with it.
In order to ensure the full effectiveness of the requirement to take due account of the state of health of the third-country national concerned and, where appropriate, his or her family life and the best interests of the child, it is necessary therefore for the national court before which an action against an entry ban decision adopted on the basis of national legislation which cannot be interpreted in conformity with the requirements flowing from Article 5 of Directive 2008/115, to examine whether it can disapply only the part of that legislation which makes it impossible to take due account of those requirements.  If it cannot do so, the national court is required to disapply the national legislation in its entirety and to base its decision directly on Article 5.
However, the direct effect of Article 5 of Directive 2008/115 cannot require a national court that has disapplied national legislation which is contrary to it to apply earlier national legislation which would grant safeguards additional to those under Article 5.
It follows from the foregoing considerations that Article 5 of Directive 2008/115 must be interpreted as meaning that, where a national court is seised of an action against an entry ban decision adopted pursuant to national legislation which is incompatible with that Article 5 and which cannot be interpreted consistently with it, that court must disapply that legislation to the extent that it does not comply with that article and, where necessary to ensure the full effectiveness of Article 5, apply that article directly in the dispute before it.

The fourth question
By its fourth question, the referring court asks, in essence, whether Article 13 of Directive 2008/115, read in conjunction with Article 47 of the Charter, must be interpreted as precluding a national practice by which the administrative authorities of a Member State refuse to give effect to a final decision of a court ordering the suspension of enforcement of an entry ban decision on the ground that that decision had already been the object of an SIS alert.
In the present case, it is clear, more specifically, from the case file before the Court that, on 31 March 2021, the referring court ordered the suspension of enforcement of the decision banning entry and stay at issue in the main proceedings both because of that court’s intention to refer a request for a preliminary ruling to the Court and because of the unfavourable consequences for M.D., as well as for his minor child and his partner, of the enforcement of that decision.
With the benefit of that preliminary observation, it should be noted, in the first place, that, pursuant to Article 13(1) of Directive 2008/115, the third-country national concerned is afforded an effective remedy to challenge, inter alia, the lawfulness of the entry ban decision of which he or she is the subject.  Pursuant to paragraph 2 of that article, the competent authority or body hearing such an action must be able to suspend temporarily the enforcement of an entry ban decision, unless a suspension of the latter is already applicable under national legislation.
Therefore, while Article 13(2) of Directive 2008/115 does not require that an action against an entry ban decision has suspensory effect, it remains the case that, where a Member State does not provide in legislation for such a suspension, the authority or body competent to examine that action must have the possibility of suspending the enforcement of that decision  (see, to that effect, order of 5 May 2021,
CPAS de Liège
, C‑641/20, not published, EU:C:2021:374, paragraph 22).
It would be contrary to the effectiveness of that provision if an administrative authority were to be permitted to refuse to apply a decision by which a court, hearing an action against an entry ban decision, ordered the suspension of the enforcement of that decision (see, by analogy, judgment of 29 July 2019,
Torubarov
, C‑556/17, EU:C:2019:626, paragraphs 55 to 59 and 66). Furthermore, the right to an effective remedy, enshrined in Article 47 of the Charter and given specific expression in Article 13 of Directive 2008/115 would be illusory if the legal order of a Member State permitted a final and mandatory court decision to remain ineffective to the detriment of a party (see, to that effect, judgments of 19 June 2018,
Gnandi
, C‑181/16, EU:C:2018:465, paragraph 52, and of 19 December 2019,
Deutsche Umwelthilfe
, C‑752/18, EU:C:2019:1114, paragraphs 35 and 36).
The fact that the decision banning entry and stay at issue in the main proceedings had already been the object of an alert in the SIS by the Member State concerned does not undermine the conclusion set out in the preceding paragraph of this judgment. In accordance with Article 34(2) of Regulation No 1987/2006, that Member State is at liberty to delete data entered into the SIS, following, inter alia, a court decision ordering the suspension of enforcement of that entry ban decision which justified the alert.
In addition, it should be noted that, according to well-established case-law, the full effectiveness of EU law requires that a court seised of a dispute governed by EU law must be able to grant interim relief in order to ensure the full effectiveness of the judgment to be given, when it decides to refer a request for a preliminary ruling to the Court. Accordingly, the effectiveness of system established by Article 267 TFEU would be compromised if the authority attaching to such interim relief could be disregarded, in particular, by a public authority of the Member State in which those measures were adopted (see, to that effect, judgment of 6 October 2021,
W.Ż.(Chamber of Extraordinary Control and Public Affairs of the Supreme Court
–
Appointment)
, C‑487/19, EU:C:2021:798, paragraph 142).
It follows from all of the above considerations that Article 13 of Directive 2008/115, read in conjunction with Article 47 of the Charter, must be interpreted as precluding a national practice by which the administrative authorities of a Member State refuse to apply a final court decision ordering the suspension of enforcement of an entry ban decision on the ground that that decision had already been the object of an SIS alert.

Costs
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.
On those grounds, the Court (Fourth Chamber) hereby rules:
1.
Article 20 TFEU
must be interpreted as precluding a Member State from adopting a decision banning entry into the territory of the European Union in respect of a third-country national, who is a family member of a Union citizen, a national of that Member State who has never exercised his or her right to free movement, without having examined beforehand whether there is, between those persons, a relationship of dependency which would de facto compel that Union citizen to leave the territory of the European Union altogether in order to go with that family member and, if so, whether the grounds on which that decision was adopted allow a derogation from the derived right of residence of that third-country national.
2.
Article 5 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
must be interpreted as precluding that a third-country national, who should have been the addressee of a return decision, is the subject – in a direct extension of the decision which withdrew from him or her, for reasons connected with national security, his or her right of residence on the territory of the Member State concerned – of a decision banning entry into the territory of the European Union, adopted for identical reasons, without consideration being given, beforehand, to his or her state of health and, where appropriate, his or her family life and the best interests of his or her minor child.
3.
Article 5 of Directive 2008/115
must be interpreted as meaning that, where a national court is seised of an action against an entry ban decision adopted pursuant to national legislation which is incompatible with that Article 5 and which cannot be interpreted consistently with it, that court must disapply that legislation to the extent that it does not comply with that article and, where necessary to ensure the full effectiveness of Article 5, apply that article directly in the dispute before it.
4.
Article 13 of Directive 2008/115, read in conjunction with Article 47 of the Charter of Fundamental Rights of the European Union,
must be interpreted as precluding a national practice by which the administrative authorities of a Member State refuse to apply a final court decision ordering the suspension of enforcement of an entry ban decision on the ground that that decision had already been the object of an alert in the Schengen Information System.
[Signatures]
*
Language of the case: Hungarian.