Mr. Kelly generated further heat this week when he dismissed many of the more than one million immigrants who were brought to the country illegally as children but who did not apply for the protection of an Obama-era program that Mr. Trump ordered ended next month. Some of them “were the people that some would say were too afraid to sign up, others would say were too lazy to get off their asses, but they didn’t sign up,” he told reporters.

Mr. Kelly at first came to the defense of Rob Porter, the White House staff secretary, who resigned in the face of allegations of spousal abuse. “Rob Porter is a man of true integrity and honor, and I can’t say enough good things about him,” Mr. Kelly said. “He is a friend, a confidant and a trusted professional.”

As outrage grew over a photograph showing an ex-wife of Mr. Porter with a black eye, Mr. Kelly issued a new statement. “I was shocked by the new allegations released today against Rob Porter,” he said. “There is no place for domestic violence in our society.” But he added: “I stand by my previous comments of the Rob Porter that I have come to know since becoming chief of staff and believe every individual deserves the right to defend their reputation.”

Mr. Porter’s case raised questions about what Mr. Kelly knew and when. The White House was informed as far back as August that Mr. Porter’s security clearance was being held up because of domestic allegations. Mr. Kelly has known about the allegations at least since last fall, according to officials who asked not to be named.

Raj Shah, a White House spokesman, said on Thursday that Mr. Kelly was not “fully aware” of the details until this week. Mr. Shah also insisted that Mr. Trump remained behind Mr. Kelly. “The president has confidence in his chief of staff,” he said.

One official insisted that there was minimal knowledge in the White House about Mr. Porter’s troubles. The official said that Mr. Kelly felt misled by Mr. Porter’s account of what had happened. A friend of Mr. Kelly’s said he had learned the details of Mr. Porter’s situation only an hour before suggesting he resign.

But White House officials said privately that the president was frustrated with both Mr. Kelly and the White House communications director, Hope Hicks, who in recent weeks has been dating Mr. Porter. Ms. Hicks was one of those rallying the White House to Mr. Porter’s defense when the allegations first surfaced in The Daily Mail.