On those grounds, the Court (Grand Chamber) hereby rules:
1.
Article 15(5) and (6) 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
meaning that the maximum duration of detention laid down in those provisions must
include a period of detention completed in connection with a removal procedure
commenced before the rules in that directive become applicable.
2.
A period during which a person has been held in a detention centre on the basis of
a decision taken pursuant to the provisions of national and Community law concerning
asylum seekers may not be regarded as detention for the purpose of removal within the
meaning of Article 15 of Directive 2008/115.
3.
Article 15(5) and (6) of Directive 2008/115 must be interpreted as meaning that the
period during which execution of the decree of deportation was suspended because of a
judicial review procedure brought against that decree by the person concerned is to be
taken into account in calculating the period of detention for the purpose of removal,
where the person concerned continued to be held in a detention facility during that
procedure.
4.
Article 15(4) of Directive 2008/115 must be interpreted as not being applicable
where the possibilities of extending the periods of detention provided for in Article 15(6)
of Directive 2008/115 have been exhausted at the time when a judicial review of the
detention of the person concerned is conducted.
5.
Article 15(4) of Directive 2008/115 must be interpreted as meaning that only a real
prospect that removal can be carried out successfully, having regard to the periods laid
down in Article 15(5) and (6), corresponds to a reasonable prospect of removal, and that
that reasonable prospect does not exist where it appears unlikely that the person
concerned will be admitted to a third country, having regard to those periods.
6.
Article 15(4) and (6) of Directive 2008/115 must be interpreted as not allowing,
where the maximum period of detention laid down by that directive has expired, the
person concerned not to be released immediately on the grounds that he is not in
possession of valid documents, his conduct is aggressive, and he has no means of
supporting himself and no accommodation or means supplied by the Member State for
that purpose.
[Signatures]
* Language of the case: Bulgarian.