It is the duty of municipal corporations to publish such bylaws and ordinances as shall be necessary to:
(1) Secure such corporations and their inhabitants against injuries by fire, thieves, robbers, burglars, and other persons violating the public peace;
(2) Suppress riots, gambling, and indecent and disorderly conduct; and
(3) Punish all lewd and lascivious behavior in the streets and other public places.