New York City reached an agreement on Thursday with plaintiffs challenging the controversial stop-and-frisk procedure.

The agreement includes a federal court-appointed monitor over the next three years who will oversee the New York Police Department’s stop-and-frisk policy.

The monitor also has the power to issue reports to court on the city’s enactment of the policy adheres to Constitutional protections.

At the same time, city government will be involved in a “joint process” with community leaders to help overhaul the use of the procedure, Mayor Bill de Blasio’s office said.

“This is a defining moment in our history. It’s a defining moment for millions of our families, especially those with young men of color. And it will lay the foundation for not only keeping us the safest big city in America, but making us safer still. This will be one city, where everyone’s rights are respected, and where police and community stand together to confront violence,” said Mayor Bill de Blasio.

The de Blasio administration previously began the process of asking the Court of Appeals to send the case to the federal district court.

The Department of Law, along with the plaintiffs in the case, have also agreed to recommend the court’s monitor have the three-year oversight with the stipulation that the NYPD is in “substantial compliance” with the ruling.

Once the resolution is formally confirmed by the court, the city will move to withdraw its initial appeal of the case striking down the broad aspects of stop and frisk.