John Kelly, President Trump’s chief of staff, is grimly suited to addressing the family of a fallen service member. Mr. Kelly, a retired four-star general, is the highest-ranking officer to lose a child in Iraq or Afghanistan. His son Second Lt. Robert Kelly was killed in Afghanistan in 2010.

After more than 40 years with the Marines, Mr. Kelly possesses the gravitas and credibility on matters of military and public service that his boss does not. Which is perhaps why Mr. Trump consulted him for advice on how best to console Myeshia Johnson after her husband, Sgt. La David Johnson, was killed under still-unexplained circumstances in Niger.

Representative Frederica Wilson, a Florida Democrat and family friend, said Mr. Trump had upset Ms. Johnson by seeming to forget her husband’s name and by saying, in effect, that Sergeant Johnson knew what he was signing up for. Mr. Trump responded by attacking the congresswoman and insulting the family, insisting he’d said the right thing.

Mr. Kelly then weighed in at a media briefing on Thursday. One might have expected him to bring some dignity to this agonizing and confounding episode, putting things right with remarks chosen with the care for which he is known among his fellow service members. But after a passionate and moving recounting of Gold Star families’ trauma, he instead waded waist-deep into the morass Mr. Trump had created, insulting Ms. Wilson by accusing her of taking credit in 2015 for securing funding for a federal building in Miami named for two slain F.B.I. agents. He said she “stood up there and all of that and talked about how she was instrumental in getting the funding for that building, and how she took care of her constituents because she got the money, and she just called up President Obama, and on that phone call he gave the money — the $20 million — to build the building.”