After serving at the unsteady right hand of President Donald Trump for the past one-and-a-half years, White House Chief of Staff John Kelly is leaving around the end of year, the president announced Saturday, concluding a tumultuous tenure as the administration’s “alpha dog” after the results of a midterm election put the president’s legislative agenda—and, potentially, his administration—in jeopardy.

In doing so, Kelly became the latest in a long string of casualties in a West Wing rife with dysfunction, hostility and vicious infighting between factions of the president’s senior staff.

Speaking to reporters on the South Lawn of the White House before leaving for the Army-Navy football game in Philadelphia, Trump announced that “John Kelly will be leaving toward the end of the year” adding that the former four-star general is a “great guy.”

The president said he would be making a decision on Kelly's replacement “over the next day or two,” and that the person might hold the position on an interim basis.

In recent months, constant turf battles involving Kelly have spilled into public view, the most dramatic being a screaming match with National Security Advisor John Bolton after he reportedly made a negative remark about Homeland Security Chief Kirstjen Nielsen, a close Kelly ally who has long been rumored to be on her way out.

When Trump tapped Kelly for the post in July 2017, he was widely expected to be a calming, orderly force. “John Kelly, New Chief of Staff, Is Seen as Beacon of Discipline,” declared a headline in the New York Times. The cover of Time Magazine called him “TRUMP’S LAST BEST HOPE.”

And Kelly was initially successful in bringing a semblance of order to a chaotic West Wing after former Republican National Committee chair Reince Priebus, who holds the modern record for the briefest tenure of any White House chief of staff, was dismissed via tweet.

But his strategy of clamping down access to the president earned him enemies among a coterie of Trump aides and advisors, who saw their influence over the president stymied along with their access.

The notoriously independent president himself also chafed at Kelly’s efforts to control the lines of communication within the executive mansion, which is why the efforts were ultimately unsuccessful. That failure reportedly left Kelly so demoralized that he no longer cared whether Trump even finished his term in office without impeachment.

A number of those ancillary Trump-world personalities—people like Anthony Scaramucci, Corey Lewandowski, and Chris Christie, whose lack of official positions in the government didn’t hamper their direct lines to the president’s ear—had begun privately and publicly expressing dissatisfaction with Kelly in recent weeks through both media appearances and conversations with the president.

Scaramucci, whom Kelly quickly sacked from his 11-day tenure as White House communications director, was quick to dance on Kelly’s grave. “The best thing Reince Priebus has going for him is John,” he told The Daily Beast. “It’s basically a race to the bottom as to who was the worst chief of staff in White House history.”

Kelly further imperiled his standing with the president after he mishandled a domestic abuse scandal within the White House, which resulted in the resignation of multiple staffers and triggered intense scrutiny of interim security clearances for senior officials. Kelly had initially defended former Staff Secretary Rob Porter after the latter was accused of both emotionally and physically abusing two ex-wives, calling him “a man of true integrity and honor.” Kelly later backtracked, claiming that he had not known about the severity of the charges and acted swiftly when he was shown photographs of Colbie Holderness, Porter’s first wife, with a black eye.

But that defense was quickly called into question when the Washington Post reported that Kelly had known about Porter’s alleged abuse—which was extreme enough to prompt his second wife to obtain a temporary emergency order of protection against him—since the fall. Kelly’s reputation within the West Wing took additional hits after speechwriter David Sorensen became the second White House aide to resign over accusations of domestic violence in less than a week.

Sorensen, like Porter, denied those allegations.

As staff secretary, Porter regularly handled some of the most sensitive information in the government’s possession—despite the past allegations of domestic violence preventing him from obtaining a permanent top-secret security clearance. After Porter’s interim security status became public knowledge, closer examinations of interim security clearances more than a year into Trump’s tenure revealed that dozens of senior White House officials had not yet passed their background checks.

Kelly would later admit that, “in terms of the handling of classified material, the Trump administration “wasn’t up to the standards that I'd been used to.”

Despite those failings, Kelly continued at the time, “I have absolutely nothing to even consider resigning over.”

With Kelly’s pending departure, the White House has now seen the departures of two chiefs of staff, five communications directors, a press secretary, a chief strategist, a National Security Advisor, a White House counsel, and two deputy national security advisors, among others. That historically high turnover rate for senior staff was one of the issues that Kelly had been brought on to solve—a job, he remarked in early March, he didn’t even want.

“The last thing I wanted to do was walk away from one of the great honors of my life, being the secretary of Homeland Security,” Kelly said at a ceremony celebrating the department he used to lead, “but I did something wrong and God punished me, I guess.”