In 2013, John F. Kelly, a general at the time, defended a junior Marine officer who was accused of poor leadership after going on patrol in Afghanistan with team members who urinated on the bodies of three dead Taliban militants. Two years later, in 2015, he stood up for a Marine colonel facing a litany of charges, including sexual harassment.

Now the White House chief of staff, Mr. Kelly has come to the defense of a subordinate, engulfing him in a Trump administration crisis that could lead to his own undoing.

When accusations surfaced this week that Rob Porter, the White House staff secretary, had physically abused his two former wives, Mr. Kelly described the aide as “a friend, a confidant and a trusted professional.” He later said that he was “shocked” by the allegations — which spurred the release of a photograph of one of Mr. Porter’s former wives with a black eye — and said, “there is no place for domestic violence in our society.”

Mr. Porter resigned on Wednesday.

Mr. Kelly did not personally know the Marine he defended in the 2013 investigation that focused on the 2011 desecration of the Taliban bodies. In an interview on Friday, James V. Clement, who was the captain facing charges, said Mr. Kelly must have seen something in his case that spurred him to step up.

