WASHINGTON — More than any recent resident of the White House, President Trump has used the military and ‘‘my generals,’’ as he often calls them, as a shield against criticism from political rivals.
And no general in recent weeks has been a more ardent or harder-edged defender of the president than John F. Kelly, a retired Marine four star and the White House chief of staff.
But on Tuesday, the White House got a lesson in the downsides of relying on generals in times of political crisis when Kelly in an interview suggested that an inability to ‘‘compromise’’ had caused the nation’s Civil War.
His remarks drew an immediate backlash in Washington and among some historians, who noted that the North spent decades reaching compromises with the South over slavery.
The comments also revived a chorus of criticism that began two weeks ago, when Kelly lamented that nothing in the United States was ‘‘sacred’’ anymore and denigrated a Florida congresswoman by misstating her remarks at a building dedication in honor of two slain FBI agents.
‘‘He violated the first basic rule of the chief of staff, which is not to make yourself the news of the day,’’ said former Defense Secretary Leon E. Panetta, who worked with Kelly in the Pentagon and also served as White House chief of staff.
‘‘I have no idea what he was trying to say because history is not on his side,’’ Panetta added Tuesday.
Kelly — Trump’s first homeland security secretary — was brought to the White House over the summer in an attempt to impose order on a chaotic policy process and feuding staff, and has received generally high marks on that score.
He bolted shut the open door to the Oval Office and banished ideologues such as former chief strategist Stephen K. Bannon.
But the former general has struggled in the more political aspects of his job and, at times, has seemed to be a detriment to a White House reeling from a series of self-inflicted wounds.
Kelly’s public stumbles highlight the downsides of relying heavily on current and military brass to fill political jobs traditionally filled by civilians.
In addition to Kelly, Trump has turned to an active duty three-star general, H.R. McMaster, to act as his national security adviser and a retired Marine four star, Jim Mattis, to serve as his secretary of defense.
The White House’s national security staff, meanwhile, is composed of an unusually large number of current and former military officers.
Kelly, though, has been pressed into a far more political role than the other top brass. Those who served with him in the Pentagon describe a general who was often maddened by politics and viewed members of Congress as self-serving.
‘‘He was pretty cynical and thought that a lot of politicians were full of hot air,’’ said Derek Chollet, a former top official in the Obama Pentagon who worked with Kelly.
‘‘It was always a puzzle how this was going to work out. Trump is not a process guy. And this position is all about politics,’’ said Chollet.
Said Panetta, ‘‘John is a great Marine . . . but he is not a politician and one thing he lacks is the ability to look at the big political picture and understand what you should and shouldn’t say as chief of staff.’’
So far, the White House and Trump, who has a far different take on political discourse than any of his predecessors, are backing Kelly.
‘‘The media continue to want to make this and push that this is somehow a racially charged and divided White House,’’ White House press secretary Sarah Huckabee Sanders said at Tuesday’s press briefing, arguing that Kelly’s Civil War comments had been taken out of context in a manner that was ‘‘absurd and disgraceful.’’
One former White House adviser, who still works in government and insisted on anonymity to speak candidly, said Kelly’s higher public profile and more overtly political stance have been welcomed by President Trump and taken as marks of success.
There is a ‘‘bunker mentality’’ around the president, this person said, and Kelly is seen as ‘‘shooting out.’’
The view that Kelly is being helpful to Trump is not universal, however.
Kelly is seen by some in the West Wing as violating his own advice that those who serve the president should keep a low profile and avoid drama.
As president, Trump has often prioritized loyalty to him and his administration, and on that score Kelly has repeatedly delivered.
After Representative Frederica S. Wilson, Democrat from Florida, said Trump behaved insensitively during a condolence call with the widow of a US soldier slain in Niger, Kelly — whose son was killed in combat in Afghanistan — leapt immediately to the president’s defense.
He movingly described the path that the bodies of dead soldiers and Marines take as they make their way home from overseas battlefields and described the sacrifices that military families make for the country.
He then carried his defense a step further by slamming Wilson, a family friend, for listening in on the call and criticizing the president.
Kelly called her an ‘‘empty barrel’’ and relayed an unflattering story about her conduct at the building dedication, which a videotape later suggested was incorrect.
In an interview aired Monday night with Fox News host Laura Ingraham, Kelly declined to apologize for those remarks.
Asked to weigh in on a move by a Virginia church to remove plaques that honored General Robert E. Lee and George Washington, he described the Confederate general as an ‘‘honorable man.’’
‘‘He was a man that gave up his country to fight for his state, which 150 years ago was more important than country,’’ Kelly told Fox.