(1) If it appears there is no reasonable ground to fear the commission of the offense alleged to have been threatened, the person complained of shall be discharged. The complainant may be ordered to pay the costs of the proceedings if the magistrate believes the complaint was unfounded and frivolous.
(2) If there is reasonable ground to fear the commission of an offense, the court may, in addition or as an alternative to other relief, enter an order permanently restraining the person from engaging in illegal conduct or acting in any manner that could result in illegal conduct or the person complained of may be required to enter into an undertaking in a sum not to exceed $3,000, with one or more sufficient sureties, to keep the peace toward the people of this state and particularly toward the persons endangered. The conditions of the undertaking shall be in writing and shall be for a period of six months. It may be extended on good cause shown for a longer period or enlarged and a new undertaking may be required. (a) If the undertaking is given, the party complained of shall be discharged. (b) If the undertaking is not given, the magistrate shall commit the defendant to jail specifying in the warrant of commitment the requirement to give security, the amount thereof, and the effective period of time. (c) A person committed for not giving the required undertaking may be discharged by any magistrate when he provides the undertaking.
(a) If the undertaking is given, the party complained of shall be discharged.
(b) If the undertaking is not given, the magistrate shall commit the defendant to jail specifying in the warrant of commitment the requirement to give security, the amount thereof, and the effective period of time.
(c) A person committed for not giving the required undertaking may be discharged by any magistrate when he provides the undertaking.