The commission of public offenses may be prevented by proceedings:
(1) For suppressing riots and resistance to lawful authority;
(2) For requiring security to keep the peace or for good behavior; and
(3) For arresting and confining insane, drunken, and disorderly persons.