Where a court orders the immediate release of a person whose pre-trial detention is unlawful due to non-compliance with the time limits or formalities provided for in this Code, it may, in the same decision, place the person under judicial supervision if this measure is essential to ensure one of the objectives listed in Article 144.
When, other than in the cases provided for in the first paragraph of this article, the public prosecutor orders the release of a person whose pre-trial detention is irregular due to non-compliance with the time limits or formalities provided for by this code, he or she may immediately refer the matter to the liberty and custody judge for orders for the immediate placement of the person concerned under judicial supervision if this measure is indispensable to ensure one of the objectives listed in article 144.