D.C. Police Chief Peter Newsham is leaving the force to take over the police department in Prince William County, Va., ending a three-decade career in law enforcement in the nation’s capital.

His departure from one of the most visible law enforcement posts in the country comes as homicides escalate in the District and the chief finds himself increasingly at odds with city lawmakers on how to negotiate changes in policing amid a reckoning over race and social justice.

The news came abruptly in a news release from the Prince William Board of County Supervisors. D.C. Council Chairman Phil Mendelson (D) learned of Newsham’s new job when a reporter contacted him Tuesday night.

In a statement, Mayor Muriel E. Bowser (D) thanked the chief and said that “he led the department through a time of great change and challenge for our city and our nation.”

She said an interim chief would be announced soon.

Newsham said his departure felt bittersweet, but he looked forward to a new challenge.

“After 31 years, it’s time for a change, and I saw the opportunity in Prince William,” Newsham said in an interview. “It’s a county that’s growing, a county that needs good policing like any part of [the District].”

Mendelson said he was sorry to see Newsham leave, but he looked forward to the chance for the District to select a new chief at a time when both the public and the council have found fault with the police force.

“Given all of the turbulence around policing in America, I think this presents an opportunity for MPD to develop new strategies … to help build greater community confidence,” Mendelson said.

The D.C. police union said Newsham had “led a storied and decorated career” and that his “contributions to the MPD will not be soon forgotten.”

The chief, who earns $282,716 annually and will make $215,000 in Prince William, said he will stay in his role until after President-elect Joe Biden’s inauguration in January.

D.C. will join a number of the Washington area’s other jurisdictions in hunts for police chiefs. Over the past five months, the commanders of departments in Fairfax and Arlington counties in Virginia, and Prince George’s and Anne Arundel counties in Maryland, all have announced they were stepping down or retiring.

In the District, tensions between Newsham and the liberal D.C. Council have been growing for some time, and became worse in the aftermath of demonstrations drawing thousands to Washington to rally for changes to policing in the wake of George Floyd’s death in police custody in Minneapolis.

The council approved $15 million in cuts to the police department — a relatively modest trim compared with the steep cuts sought by activists — but one opposed by the mayor, who said it would jeopardize public safety. Lawmakers also approved emergency legislation, including a measure requiring the department to publicly identify officers who use deadly force and to post footage of the incidents. Police and lawmakers also feuded over law enforcement tactics used against protesters, including spraying chemical irritants.

The council is growing increasingly skeptical of law enforcement with the arrival of council member-elect Janeese Lewis George, a Democrat who will represent Ward 4 and a vocal critic of police, and council member Brooke Pinto (D-Ward 2), a supporter of criminal justice overhauls, replacing a more conservative member of the council.

Even before the Floyd demonstrations, the council had been scrutinizing police behavior, mandating the use of body cameras in 2015 in the aftermath of racial justice protests over the death of Michael Brown in Ferguson, Mo.

Council member Trayon White Sr. (D-Ward 8), who has sparred with Newsham, said in a text message Tuesday night, “I don’t see no one crying about Newsham leaving.”

Newsham said he felt like he has accomplished what he set out to do in the District, and he emphasized that criticism from the council and the public did not factor into his decision.

“You can say what you want about disagreements the police department had with the council, but at the end of the day, it’s those disagreements that put the city in a better place,” he said.

Over the past year, Newsham pushed back against the criticism. He has noted he spent nearly two decades rebuilding a department whose officers once led the nation in shooting people — a time he recently described as “dark days” — and said he felt his efforts to bring change went unappreciated by lawmakers.

Newsham, who was named chief in 2017 by Bowser, infuriated members of the council this summer when he accused them of “abandoning his force.” He said during a budget hearing that victims of homicide were “getting lost in the conversation” over policing changes, and he decried the council’s moves as a “knee-jerk” reaction to demonstrators. He called the push to defund “a tag line.”

Newsham is expected to begin in Prince William in February. The city will now join other area jurisdictions in their searches for a chief.

Earlier this month, Fairfax County Police Chief Edwin C. Roessler Jr. announced he would leave in February. The department said the move was long planned, but all the department’s unions had expressed reservations about his leadership.

Anne Arundel County Police Chief Timothy Altomare retired in August, citing changes being made amid demonstrations. Prince George’s County Police Chief Hank Stawinski resigned abruptly in June following the release of a report alleging racial discrimination and harassment in the department.

Antonio Olivo and Julie Zauzmer contributed to this report.