The liberty and custody judge shall rule by order within twenty-four hours of the matter being referred to him or her or, where the requirements of the investigation so dictate, within forty-eight hours thereof. The judge shall rule after hearing the person concerned, or his or her counsel if he or she has one, or the latter having been duly notified.