New York City will settle its long-running legal battle over the Police Department’s practice of stopping, questioning and often frisking people on the street — a divisive issue at the heart of the mayoral race last year — by agreeing to reforms that a judge ordered in August, Mayor Bill de Blasio announced on Thursday.

In making the announcement, which he said he hoped would end a turbulent chapter in the city’s racial history, Mr. de Blasio offered a sweeping repudiation of the aggressive policing practices that had been a hallmark of his predecessor, Michael R. Bloomberg, but that had stoked anger and resentment in many black and Latino neighborhoods. He essentially reversed the course set by Mr. Bloomberg, whose administration had appealed the judge’s ruling.

“We’re here today to turn the page on one of the most divisive problems in our city,” Mr. de Blasio said at a news conference. “We believe in ending the overuse of stop-and-frisk that has unfairly targeted young African-American and Latino men.”

The judge, Shira A. Scheindlin of Federal District Court in Manhattan, found that the department’s stop-and-frisk tactics were unconstitutional, and that it had resorted to “a policy of indirect racial profiling.” At the height of the program, in the first quarter of 2012, the police stopped people — mostly black and Latino men — on more than 200,000 occasions. A vast majority of those stopped were found to have done nothing wrong.