Public offenses may be prevented by the intervention of the officers of justice: 1. By requiring security to keep the peace. 2. By forming a police in cities and towns, and by requiring their attendance in exposed places. 3. By suppressing riots. R.L.1910, § 5559.