Any peace officer having grounds for making an arrest may take the accused into custody or, already having done so, detain him further when the accused fails to identify himself satisfactorily, or refuses to sign the citation, or when the officer has reasonable grounds to believe that (1) the accused will refuse to respond to the citation, (2) such custody is necessary to protect the accused or others when his continued liberty would constitute a risk of immediate harm, (3) such action is necessary in order to carry out legitimate investigative functions, (4) the accused has no ties to the jurisdiction reasonably sufficient to assure his appearance, or (5) the accused has previously failed to appear in response to a citation.