NEW YORK >> After years of clashes in the street and the courts, the New York Police Department has agreed to a legal settlement that will overhaul how it handles demonstrations and ban the practice of boxing in protesters and then arresting them.

In addition to ending that practice, known as kettling, the department will use a tiered system of deescalation for protests before deploying more officers and will install a high-ranking executive to make sure officers are complying with new rules.

The department agreed to the changes as part of a deal filed in federal court Tuesday with the office of New York Attorney General Letitia James, who sued the agency in January 2021 over what she called widespread abuses during protests the previous summer after the killing of George Floyd in Minneapolis.

The settlement, which capped a legal fight that began after images of violent confrontations between the police and protesters stunned residents and many city leaders, will force the country’s largest police department to dramatically change how it responds to peaceful demonstrations.

More than 2,000 demonstrators were arrested during the protests three years ago, most of them while protesting peacefully. An investigation by the attorney general’s office found that police officers beat protesters with batons, rammed them with bicycles, arrested legal observers and medics without proper justification, and used the containment strategy in which protesters were penned in by the police, then charged at or beaten with batons.

According to the settlement filed Tuesday, the department will also be overseen by a committee made up of representatives from James’ office, the commissioner of the city Department of Investigation, the New York Civil Liberties Union and other agencies. The police executive assigned to supervise protest responses would also be a member of the committee.