WASHINGTON — John F. Kelly, the White House chief of staff, told officials in the West Wing on Friday that he was willing to step down over his handling of allegations of spousal abuse against Rob Porter, the staff secretary who resigned in disgrace this week over the accusations, according to two officials aware of the discussions.

The officials emphasized that they did not consider a resignation imminent, and that Kelly — a retired four-star Marine general who early in his tenure often used a threat of quitting as a way to temper President Donald Trump’s behavior — had made no formal offer. In comments to reporters at the White House on Friday, Kelly said he had not offered to resign.

But his suggestion in private that he would be willing to step down if the president wanted him to reflected the degree to which the scandal surrounding Porter has engulfed the White House, touching off a bitter round of recriminations that could result in a shake-up at the highest levels.

Two West Wing advisers and a third person painted a picture of a White House staff rived and confused, with fingers pointed in all directions and the president privately expressing dissatisfaction with Kelly.

Some complained that Donald F. McGahn II, the White House counsel, who learned in January 2017 that Porter was concerned about potentially damaging accusations from two ex-wives, had not been forthcoming enough about what he knew. Others faulted Hope Hicks, the communications director, who had been romantically involved with Porter, for soliciting statements of support for him when the accusations became public.

And many, including the president himself, have turned their ire on Kelly for vouching for Porter’s character and falsely asserting that he had moved aggressively to oust him once his misdeeds were discovered.

For all the turmoil, Trump on Friday warmly praised Porter, saying it was a “tough time” for his former aide and noting that Porter had denied the accusations.

“We wish him well,” Trump said of his former aide, who was accused of physical and emotional abuse by two ex-wives. The president added, “He also, as you probably know, says he is innocent, and I think you have to remember that.”

“He worked very hard,” Trump told reporters in the Oval Office when asked for a comment about Porter. The president said he had only “recently” learned of the allegations against his former aide and was surprised.

“He did a very good job when he was in the White House, and we hope he has a wonderful career, and he will have a great career ahead of him,” Trump said. “But it was very sad when we heard about it, and certainly he’s also very sad now.”

The glowing praise of a staff member accused of serial violence against women was in line with the president’s own denials of sexual impropriety despite accusations from more than a dozen women and his habit of accepting claims of innocence from men facing similar allegations. Among them was Roy Moore, the former Republican Senate candidate in Alabama, who is accused of molesting teenage girls.

But later in the day, the White House dealt far more aggressively with another allegation of abuse. A spokesman confirmed that a second White House staff member, David Sorensen, a speechwriter, had resigned over allegations by his former wife that he had abused her during their marriage. The spokesman said officials confronted Sorenson on Thursday night when they learned of the accusations and that he had denied them.

Sorensen’s resignation, first reported by the Washington Post, came as a new timeline emerged indicating that top officials knew much earlier than previously disclosed that Porter faced accusations of violence against women.

Shortly after Trump’s inauguration, McGahn, the White House counsel, first learned from Porter himself that there could be allegations against him, according to two people briefed on the situation. McGahn’s knowledge of the accusations in January was first reported by the Washington Post.

Porter told him about the possible allegations because he was concerned that what he characterized as false charges from aggrieved women who were out to destroy him could derail his FBI background check, according to one of the two people briefed on the matter.

Six months later, the FBI told McGahn that accusations of domestic abuse had indeed surfaced in Porter’s background check. McGahn opted at that time to let the FBI complete its investigation into any incidents. Porter assured McGahn, another person briefed on the matter said, that the accusations from the former wives were lies.

The emerging timeline illustrates the degree to which Porter, a clean-cut and ambitious former Rhodes scholar and Harvard Law School-educated lawyer, concealed troublesome episodes from his past that would normally be considered disqualifying for a senior White House aide.

Those efforts appear to have succeeded for months, at least in part because of the willingness of a virtually all-male staff in the top echelons of the West Wing to believe a talented male colleague over women they had never met.

Lawyers in the counsel’s office believed that the bureau — with its vast investigative powers — was best positioned to look into the accusations, the two people briefed on the matter said, and that it was not their job to investigate conduct that took place long before an official began working in the administration.

That represents a sharp break with past practice, in which White House counsels undertook elaborate vetting of senior advisers before they were hired — and looked into any serious allegations that surfaced thereafter.

In November, the White House heard back from the FBI. Senior White House officials, including Kelly, Joe Hagin, deputy chief of staff, and McGahn received word from the bureau that the allegations were credible and that Porter was not likely to pass his background check.

But while McGahn privately informed Porter and encouraged him to consider moving on, according to one of the two people briefed, no action was taken to immediately terminate him. Rather, McGahn requested that the FBI complete its investigation and come back to the White House with a final recommendation, a process that could take months.

On Friday, several White House aides described confusion among the staff about why Kelly and others had initially rallied to defend Porter, and some suggested that Kelly had tried to cover up what he knew. Others insisted that while he was aware of the broad strokes of accusations against Porter, and while he could have made more of an effort to learn more, he trusted the staff secretary’s denials.

Kelly began telling people at the White House on Thursday that he had learned the details of Porter’s situation only “40 minutes before he threw him out” two days earlier, before pictures of Porter’s bruised ex-wife began circulating.

But on Wednesday afternoon, Sarah Huckabee Sanders, the White House press secretary, and other aides had maintained to reporters that the White House fully backed Porter, who they said was leaving of his own accord. She issued a statement saying that both the president and Kelly had “full confidence” in his performance.

In a meeting with senior staff members Friday morning, Kelly appeared to be trying to paint his handling of the matter in a more favorable light. At the end of the session, according to people with knowledge of his remarks, Kelly volunteered that he had something he wanted to “clarify.”

Kelly went on to say that he had learned of Porter’s true situation less than an hour before he removed him from his job. Two people familiar with the comments said that most of the staff appeared incredulous; one person said several people in the room knew that the timeline Kelly had presented was false.

As the meeting broke up, Hicks loudly complained about what had transpired, using an expletive, a person briefed on the meeting said.

The infighting unfolded amid signs of a brewing shake-up in the West Wing.

The president has now sounded out several people as possible replacements for Kelly. Those possible replacements include Mick Mulvaney, the budget director; Rep. Kevin McCarthy of California; and Gary D. Cohn, Trump’s top economic adviser. He has also returned to a notion he has raised privately in the past, telling people he would like Thomas J. Barrack Jr., a close friend and confidant, to take the job.

Kelly is not ready to explicitly offer a resignation, according to a person familiar with his thinking. But people close to Trump said the president had begun the process of making the job so unpleasant for Kelly that it might hasten his departure, the same sort of ritual humiliation to which he subjected Reince Priebus, his first chief of staff, before his departure in July.

Despite his warm words Friday, two advisers said, Trump was livid when he learned of the allegations against Porter, and referred to his disgraced former aide in one phone call as “bad garbage.” He also expressed his frustration with both Kelly and Hicks.

On Friday evening, the White House announced new posts for 31 officials, including elevating to acting staff secretary Derek Lyons, another Harvard Law School-educated lawyer, who formerly worked on Capitol Hill and had been Porter’s No. 2. Also included on the list was the departure of Jim Carroll, a lawyer in the counsel’s office who had only recently been designated to be Kelly’s deputy, but will now become acting director of the Office of National Drug Control Policy.