In the majority of Western legal systems, the major role of the police is to maintain order, keeping the peace through surveillance of the public, and the subsequent reporting and apprehension of suspected violators of the law. They also function to discourage crimes through high-visibility policing, and most police forces have an investigative capability. Police have the legal authority to arrest and detain, usually granted by magistrates.