Retired general John F. Kelly has kept a low profile in his first weeks as White House chief of staff. (Carolyn Kaster/AP)

High-ranking military officials have become an increasingly ubiquitous presence in American political life during Donald Trump’s presidency, repeatedly winning arguments inside the West Wing, publicly contradicting the president and even balking at implementing one of his most controversial policies.

Connected by their faith in order and global norms, these military leaders are rapidly consolidating power throughout the executive branch as they counsel a volatile president. Some establishment figures in both political parties view them as safeguards for the nation in a time of turbulence.

Trump’s elevation of a cadre of current and retired generals marks a striking departure for a country that for generations has positioned civilian leaders above and apart from the military.

“This is the only time in modern presidential history when we’ve had a small number of people from the uniformed world hold this much influence over the chief executive,” said John E. McLaughlin, a former acting director of the CIA who served in seven administrations. “They are right now playing an extraordinary role.”

In the wake of the deadly racial violence in Charlottesville this month, five of the Joint Chiefs of Staff were hailed as moral authorities for condemning hate in less equivocal terms than the commander in chief did.

President Trump has surrounded himself with generals and pledged to revamp veterans' care, while also belittling the service of his opponents. Here's a look at his track record with the military. (Jenny Starrs/The Washington Post)

On social policy, military leaders have been voices for moderation. The Pentagon declined to immediately act upon Trump’s Twitter announcement that he would ban transgender people from the armed forces, instead awaiting a more formal directive that has yet to arrive.

Inside the White House, meanwhile, generals manage Trump’s hour-by-hour interactions and whisper in his ear — and those whispers, as with the decision this week to expand U.S. military operations in Afghanistan, often become policy.

At the core of Trump’s circle is a seasoned trio of generals with experience as battlefield commanders: White House Chief of Staff John F. Kelly, Defense Secretary Jim Mattis and national security adviser H.R. McMaster. The three men have carefully cultivated personal relationships with the president and gained his trust.

Critics of the president welcome their ascendancy, seeing them as a calming force amid the daily chaos of the White House.

“They are standouts of dependability in the face of rash and impulsive conduct,” said Sen. Richard Blumenthal (D-Conn.). “There certainly has been a feeling among many of my colleagues that they are a steadying hand on the rudder and provide a sense of consistency and rationality in an otherwise zigzagging White House.”

[‘It’s a hard problem’: Inside Trump’s decision to send more troops to Afghanistan]

William S. Cohen, who served as defense secretary under President Bill Clinton, said that Trump “came in with virtually no experience in governance, and there’s no coherent strategic philosophy that he holds. There has been a war within the administration, and that has yet to be resolved. . . . The military has tried to impose some coherency and discipline.”

Defense Secretary Jim Mattis, like other retired generals in the administration, sees guiding the president away from bad decisions as part of his role. (Jabin Botsford/The Washington Post)

Sen. Tom Cotton (R-Ark.), an Army veteran who served two tours in Iraq and Afghanistan, praised Trump’s circle of generals and recommended McMaster and Kelly for their posts. He said the impression in some quarters that military leaders are hawks by definition is misguided.

“What many people in Washington don’t understand is that generals are usually the most reluctant to commit troops to combat because they are the ones who have to write letters home to parents when they have fallen,” Cotton said.

Among some on the right, however, the view is more suspicious. Some Trump supporters, for example, worry about blurring the line between military and civilian leadership, as exemplified by recent headlines at Breitbart News, the conservative website run by Stephen K. Bannon, Trump’s former chief White House strategist, who clashed with several military leaders over policy.

Trump’s announcement Monday that he would escalate troop levels in Afghanistan was covered on Breitbart with alarm. Headlines warned of “unlimited war” and “nation-building” led by military leaders without links to Trump’s base.

Commentator and Trump ally Ann Coulter tweeted Monday, “The military-industrial complex wins.”

[‘It’s a coup d’etat’: Antiwar conservatives decry Trump’s Afghanistan surge]

The concerns extend to the political left as well. At ThinkProgress, a liberal website, recent articles have rapped Trump for having a government that benefits “military insiders.” One headline this month declared: “Military figures are taking over Trump’s administration.”

Trump has revered military brass since his youth, when he attended a New York military academy. He holds up generals as exemplars of American leadership and views them as kindred spirits — fellow political outsiders.

“To some degree, Trump is playing president, and I think the whole idea of being able to command a group of warriors is deeply satisfying to him,” McLaughlin said.

Robert M. Hathaway, a fellow at the Woodrow Wilson Center, said: “It should not surprise us. Candidate Trump suggested he would defer to the people he called ‘my generals’ on a whole host of issues, and they are doing just that.”

Trump idolizes swaggering commanders, such as the cinematic portrayal of George S. Patton Jr., the World War II general. But R. James Woolsey Jr., a former CIA director and undersecretary of the Navy who advised Trump during last year’s campaign, said a better comparison to Kelly, Mattis and McMaster would be George C. Marshall Jr., the Army chief of staff during World War II who went on to serve in President Harry Truman’s Cabinet.

“I think these guys are more Marshall-like than Patton-like,” Woolsey said. “They have distinguished combat records, but they’re the sort of career military men who have the intellectual capability and propensity to deal with civilian matters.”

[Trump loves the sheen of the brass, but generals come with some fixed views]

Kelly, Mattis and McMaster are not the only military figures serving at high levels in the Trump administration. CIA Director Mike Pompeo, Attorney General Jeff Sessions, Energy Secretary Rick Perry and Interior Secretary Ryan Zinke each served in various branches of the military, and Trump recently tapped former Army general Mark S. Inch to lead the Federal Bureau of Prisons.

Together with other allies in the administration, Kelly, Mattis and McMaster see their roles not merely as executing Trump’s directives but also as guiding him away from moves that they fear could have catastrophic consequences, according to officials familiar with the dynamic.

But if a narrative takes hold that these generals are manipulating the president, Trump could rebel. He chafes at any suggestion that he is a puppet and at the idea of his advisers receiving credit for his decisions. He reacted angrily in February when Time magazine put Bannon on its cover with the headline “The Great Manipulator.”

In his first month as chief of staff, Kelly has kept a low profile, sitting for no major interviews and discouraging aides from self-promotion.

Democratic lawmakers are quick to criticize Trump on just about every issue, but they hold back when it comes to the preponderance of military figures in traditionally civilian positions.

“There might be a temptation to be critical of the president in this context, but I for one am glad they’re there — because they’re thoughtful . . . because they’re lawful and because they’re rational,” Sen. Brian Schatz ­(D-Hawaii) said in an interview. “I feel like the concern about the need to maintain civilian oversight of the military is a totally legitimate one, but that concern should be addressed at a later time. In the meantime, we should be reassured that there are competent professionals there who want to make smart choices.”

That position is shared by many figures in the Republican establishment who worry about Trump’s ideas and temperament.

“The only chance we have of trying to keep this thing from blowing apart is some military discipline,” said Peter Wehner, who served in the three Republican administrations prior to this one and who opposes Trump. “It’s not military rule or a military coup.”

[National security adviser attempts to reconcile Trump’s competing impulses on Afghanistan]

Although Trump mostly has been following the military’s guidance, he easily could turn away from his generals if new problems emerge, according to people close to the president. They described Trump as with the military in spirit but guided more by his transactional instincts. They pointed out that it took weeks for him to go along with a watered-down version of the initial proposal from Mattis and McMaster on additional troops in Afghanistan.

Trump has also had a strained relationship with McMaster for months, in part because of stylistic differences between the two men. The president has little patience for the methodical and consensus-oriented policy process that McMaster employs at the National Security Council, which counts two other generals on the senior staff.

“When you look at the president’s tensions with McMaster, you can see how he could move away from them if things don’t improve in Afghanistan over the next six months,” said a senior White House official, who spoke on the condition of anonymity to share a candid assessment. “He’s not giving them some sort of blank check.”

One example is retired Army Lt. Gen. Michael Flynn, who lasted a mere 24 days in his job as national security adviser. Trump fired him in February after Flynn was allegedly not truthful with Vice President Pence about communications with the Russian ambassador during the transition.

“Individuals can be corrupt or incompetent, and that extends at times to people in the military,” Wehner said. “Things can go wrong with anyone.”