U.S. Attorney William M. McSwain, the top federal prosecutor in Philadelphia and the surrounding region, announced his resignation Thursday, effective Jan. 22, after nearly three years in his post.

His departure, which had been planned behind the scenes for weeks, was not connected to the wave of resignations President Donald Trump’s administration has seen in the days since he riled up an insurrectionist mob that stormed the Capitol last week. Instead, it comes as part of the customary changeover in leadership at U.S. Attorney’s Offices across the country that traditionally precedes each new presidential administration.

In a statement, McSwain, 51, of West Chester, expressed regret about leaving the post, saying he would miss the job “dearly.”

“I will always be grateful to have had the opportunity to serve as U.S. Attorney in the district in which I have lived most of my life, in the city in which I was born, and in the office where I learned to be a trial lawyer as an assistant U.S. Attorney,” he said. “My overriding focus as U.S. Attorney was on pursuing justice in order to protect the community. I gave this job all that I had — all day, every day.”

Seen widely in Republican circles as a potential candidate for elected office, McSwain, a former Marine infantry officer and Harvard Law graduate, did not announce any specific plans for his future Thursday aside from saying he intended to return to private practice as an attorney.

His first assistant, Jennifer Arbittier Williams, a career federal prosecutor who previously oversaw national security and terrorism cases for the office, will take over the office of more than 230 government lawyers and support staff until the administration of President-elect Joe Biden names a replacement.

The U.S. Attorney’s Office for the Eastern District of Pennsylvania, working with federal agencies including the FBI, the IRS, and the Drug Enforcement Administration, has broad investigative and prosecutorial powers in Philadelphia and eight surrounding counties.

Trump nominated McSwain, at the time a partner at the Center City law firm Drinker, Biddle & Reath, in 2017, after the resignation of Zane David Memeger, who filled the role during Barack Obama’s presidency.

More than any of his predecessors in recent memory, McSwain used the position to cement a public profile as a champion of old-school, law-and-order prosecution, zeroing in on violent crime prosecutions and high-profile public corruption indictments against Philadelphia City Councilmembers Bobby Henon and Kenyatta Johnson as well as labor leader John “Johnny Doc” Dougherty.

But his barbed statements, pointed TV interviews, and highway billboards bearing his image to advertise office initiatives often put him at odds with elected leaders in a city experimenting with reimagining the criminal justice system.

His public feud with Philadelphia District Attorney Larry Krasner — which began simmering in private almost from the minute the two men were introduced to each other in their new roles, according to sources close to both — eventually boiled over into public view as they became foils for each other on opposite sides of the debate.

McSwain blamed Krasner’s unorthodox approach to prosecution for causing an uptick in shootings, homicides, and other violent crimes. He repeatedly attacked his counterpart’s handling of cases and took the rare step of prosecuting several matters that the District Attorney’s Office was already pursuing, saying he did not trust Krasner to achieve a just outcome in the case.

For his part, Krasner rarely missed an opportunity to dismiss McSwain as a Trump toady — an attack he repeated Tuesday as the U.S. attorney, in a case he personally argued before the U.S. Court of Appeals for the Third Circuit, and scored a legal victory in his fight to block the nation’s first supervised drug injection site from opening in Philadelphia.

“The good news is our current federal prosecutor is days away from joining his hero — the most lawless and disorderly president in history — in being replaced by someone who has a sense of humanity,” Krasner said in a statement. “A newly organized Department of Justice scrubbed of Trumpian demagogues must exercise its power for the good of all people.”

McSwain also challenged Mayor Jim Kenney’s administration on several initiatives ranging from Philadelphia’s sanctuary city policy and its support for the supervised injection site to more recent pandemic-related restrictions on crowd size for public gatherings, which McSwain argued in a lawsuit had been unfairly applied to specific groups.

Still, McSwain — and his office — developed a healthy relationship with other law enforcement agencies across the region and worked frequently with figures such as Democratic Attorney General Josh Shapiro and Philadelphia City Controller Rebecca Rhynhart, also a Democrat, as well as the city’s police union on initiatives to address gun violence and public corruption.

“Accountability, integrity and fairness were all benchmarks that U.S. Attorney William McSwain exhibited during his tenure in our region,” said John McNesby, head of the Philadelphia police union, in a statement. “We’re humbled and honored to call McSwain a true law enforcement partner and colleague.”