Law enforcement broadly refers to any system by which some members of society act in an organized manner to enforce the law by discovering, deterring, rehabilitating, or punishing people who violate the rules and norms governing that society. Although the term may encompass entities such as courts and prisons, it is most frequently applied to those who directly engage in patrols or surveillance to dissuade and discover criminal activity, and those who investigate crimes and apprehend offenders, a task typically carried out by the police or another law enforcement agency.