WASHINGTON — Pressure mounted on White House Chief of Staff John Kelly Thursday as questions swirled about his defense of a senior aide he fought to keep in a highly sensitive West Wing job despite accusations of spousal abuse from two ex-wives.

White House Staff Secretary Rob Porter, a member of President Trump’s inner circle and arguably Kelly’s closest aide, cleaned out his desk Thursday. But the aftershocks of his resignation reverberated amid concerns about his access to classified information.

Kelly himself faced criticism for defending Porter only to belatedly reverse course hours after the publication of photos showing one of the ex-wives with a black eye.

“It’s fair to say we all could have done better over the last few hours or last few days in dealing with this situation,” said White House Deputy Press Secretary Raj Shah, who faced a barrage of questions about Kelly during a press briefing.

Though the allegations against Porter became public this week, Kelly had previously been given an indication that something was amiss with the staff secretary’s attempts to get a security clearance, according to an administration official who insisted on anonymity to discuss internal matters.

The chief of staff had sought information about the status of security clearance applications for top aides, and it was then he learned there were allegations against Porter from his ex-wives, said the official.

But when the allegations first emerged against Porter, a number of senior aides rallied around him. Kelly was Porter’s loudest defender, including in the first hours after the photos of alleged abuse emerged.

Only later did the chief of staff, who had argued for Porter to keep his post, release a second statement in which he said he supported Porter’s resignation.

Shah said that Trump was not aware until Tuesday of the accusations against Porter, who was a frequent presence in the Oval Office and helped craft last week’s State of the Union address. A number of lawmakers criticized Kelly, and a leading women’s group called for the chief of staff to resign.

The president, for his part, has not signaled to allies that he is on the verge of making a change. But his frustration with Kelly has grown in recent weeks.

Trump has long chafed at the controls placed on him by Kelly and in recent weeks has privately fumed about the chief of staff to his circle of informal advisers, according to two people who speak to the president regularly but are not authorized to publicly discuss private conversations. Trump also was angry that Kelly did not bring the Porter allegations to him sooner, according to one of the people.

Kelly also drew Trump’s ire last month when he seemed to suggest that the president was flip-flopping on his call for a border wall. Trump complained to aides that the chief of staff had portrayed him as a child who had to be managed, a contention that particularly irked the president in the wake of the way he was portrayed in the recent Michael Wolff book, “Fire and Fury.”

Though Trump frequently vents about senior aides, he is often loath to fire staffers. A dismissal of Kelly would surely revive the narrative of a White House in crisis as it faces the ongoing Russia probe and the midterm elections.

But Kelly’s handling of the Porter affair rattled some aides, who questioned his full-throated defense of an accused batterer, according to more than a half-dozen White House officials and outside advisers who were not authorized to speak publicly about private conversations.

Democrats swiftly called for an investigation into Porter’s presence at the White House, and some suggested that Kelly was in the cross hairs.

“If John Kelly is covering this up, he needs to be held accountable,” Sen. Jon Tester, D-Mont., told CNN’s “New Day,” adding, “He better have a really good reason. Otherwise, he’s gone, too.”

Toni Van Pelt, head of the National Organization for Women, was more direct. She revisited the accusations that Trump himself has sexually harassed women, allegations he has denied.

“White House chief of staff John Kelly must resign,” said Van Pelt. “His pathetic defense of staff secretary Rob Porter reveals his true nature – an enabler of sexual abusers, a betrayer of trust and an avoider of responsibility.”

The White House was also put on the defensive about Porter’s interim security clearance, fielding questions about how someone could handle some of the nation’s most sensitive documents while potentially being ripe for blackmail.

Attorneys who specialize in security clearance said Porter should have disclosed the allegations when he filed his national security application.