LORETTA LYNCH was sworn in as U.S. attorney general on the same day as the funeral for Freddie Gray, the 25-year-old black man whose death in Baltimore police custody brought national attention to that city’s troubled police department. So it was somehow fitting that her final days in office were marked with announcement of a detailed agreement that would reform the Baltimore Police Department. That it was followed up the next day with a scathing report documenting similar problems of racial division and unequal policing in Chicago lays down an important marker about the need for further reform that ought to be taken up by the incoming administration.

The back-to-back announcements in Baltimore and Chicago by the Justice Department capped the Obama administration’s vigorous pursuit of police departments for civil rights violations. The department opened 25 investigations, with numerous findings of excessive force and other violations.

In Baltimore, federal and city officials announced Thursday that they entered a 227-page agreement to overhaul the police department. Among the issues uncovered in the aftermath of Mr. Gray’s 2015 death: violations of constitutional rights, excessive use of force, racial disparities in practices and a pattern of retaliation against whistleblowers. Also targeted in the court decree are inadequacies in how sexual assault crimes are investigated.

In Chicago, where video of the shooting death of a black teenager by a white officer prompted federal scrutiny, a 13-month investigation by the Justice Department’s Civil Rights Division revealed a pattern of using excessive, unconstitutional force. Among the examples cited was a 16-year-old girl hit with a baton and shocked with a Taser for not leaving school after she was found to have a cellphone. Poor training, outdated technology and inconsistent guidance were some of the factors cited. Officials hope to negotiate a court decree, similar to the one reached in Baltimore, that would bind the department to change under court order.

Such court decrees have proved to be effective tools in forcing police departments to implement needed reforms, particularly with regard to practices that result in unfair treatment of minorities. But Sen. Jeff Sessions (R-Ala.), nominated by President-elect Donald Trump to replace Ms. Lynch, has made no secret of his skepticism of consent decrees, prompting some to wonder how vigorously the department will enforce the Baltimore agreement, which still must be approved by the court, or will seek to finalize a decree with Chicago.

That Chicago Mayor Rahm Emanuel (D) signed an agreement committing the city to further reforms is encouraging. So is the fact that Baltimore officials worked to reach agreement on a court decree before the end of the Obama administration. Such local buy-in for change shows a recognition that building trust between police and the communities they serve is essential to fighting crime.