(a) The court shall enter an order denying an application for court-ordered temporary or extended mental health services if after a hearing the court or jury fails to find, from clear and convincing evidence, that the proposed patient is a person with mental illness and meets the applicable criteria for court-ordered mental health services.
(b) If the court denies the application, the court shall order the immediate release of a proposed patient who is not at liberty.