If a person committed to a facility pursuant to this article leaves without permission or, in the opinion of the department, endangers the public, staff, or other patients, the department is empowered to isolate and forceably detain the person if necessary until such time as the person no longer poses a risk to others.