A person who can give evidence or testimony about the subject matter of a criminal case, with that evidence being sufficiently important to potentially change the outcome of the case, can potentially be detained as a "material witness" if there is sufficient cause to believe that the witness won't appear at trial as ordered by the court. That's a different issue than "protective custody".

