President Donald Trump’s actions in recent days have pushed the military into the most uncomfortable position in his presidency, prompting an outcry that continued to build on Thursday from retired generals, including his former defense secretary and three former chairmen of the Joint Chiefs, who have expressed grave concerns about his willingness to wield the military as a club against American citizens.

The president’s threats to employ military troops to put down protests in American cities and his steps to pull Pentagon leaders into his response to unrest in the nation’s capital have dramatically escalated the tensions that have beset the military since Trump took office, highlighting the fragility of norms surrounding the military’s role in public life.

“It should worry people, and it does worry people, when you see a default to the military rather than trying more local or domestic organizations,” said Carrie Lee, an expert on civil-military affairs.

The tensions were starkly visible this week as Defense Secretary Mark Esper scrambled to explain why he and Gen. Mark Milley, chairman of the Joint Chiefs of Staff, appeared alongside Trump outside the White House shortly after protesters were forcibly cleared from the area by authorities that included guardsmen under federal command.

The scene came as the Pentagon positioned active-duty forces near Washington in preparation for their possible use in the city, immediately reaching for a response that military leaders said should be an absolute last resort, even though there has been relatively little violence in the city in recent days. Esper drew widespread criticism early this week after he described a need to “dominate the battlespace” in reference to authorities’ response to unrest in U.S. cities.

The events have prompted unusual public rebukes from former leaders, including retired Gen. Jim Mattis, whose turn as Trump’s first defense secretary enjoyed perhaps the most bipartisan support of any Cabinet member in the Trump era.

“Never did I dream that troops taking that same oath would be ordered under any circumstance to violate the constitutional rights of their fellow citizens — much less to provide a bizarre photo op for the elected commander-in-chief, with military leadership standing alongside,” Mattis wrote, referring to Americans’ right to peaceful protest.

Two Republican lawmakers welcome Mattis’s comments and suggested that his attack might provide some of their colleagues cover to launch their own critiques of the president’s response.

Sen. Lisa Murkowski, R-Alaska, called the remarks “true and honest and necessary and overdue,” saying she was struggling to decide whether to support Trump in the November election. Sen. Mitt Romney, R-Utah, said they were “stunning and powerful.” But other Republican senators, including Lindsey Graham of South Carolina, disagreed.

The cascade of military criticism of recent events, and the military’s role in them, came also from retired Gen. Tony Thomas, the former head of U.S. Special Operations Command; retired Adm. Mike Mullen, who served as chairman of the Joint Chiefs of Staff; and retired Gen. Richard Myers, another former chairman of the Joint Chiefs of Staff who voiced “absolute sadness” at the clearing of Lafayette Square outside the White House.

On Thursday, retired Gen. Martin Dempsey, who served as chairman of the Joint Chiefs of Staff under President Barack Obama, told NPR that calling the military to suppress mostly peaceful protests “was very dangerous to me.”

“The relationship between the American people and the military — who they represent and serve — would be adversely affected if this was not handled very carefully,” Dempsey said.

The events add to a gathering crisis for Pentagon leaders, including many who have sought to reconcile their concerns about some of Trump’s policies and his personal style and their deeply ingrained culture of deference to elected leadership.

Peter Feaver, a political science professor at Duke University, said the president had framed his response to the protest as linked to maintaining order. But military leaders were additionally concerned with another set of values, including responding to racial tensions and signaling a commitment to respecting civil liberties, he said.

“The mistake for the White House is asking the military to choose between those two,” Feaver said.

One former senior officer said many current and former officers were “appalled” by the recent events. “They’ve never seen anything like it,” he said, speaking on the condition of anonymity to discuss the matter candidly. “We didn’t join the military to kill our fellow citizens.”

The tensions also mark a high-stakes moment for Esper, Trump’s fourth Pentagon chief, who has elicited Trump’s ire in recent days as he has sought to distance the Pentagon from the administration’s protest response.

In remarks on Wednesday, Esper, a former Army officer and defense lobbyist, voiced support for protesters’ outraged by the killing of George Floyd, a black man killed in police custody on May 25, and said he did not think it was necessary to invoke the Insurrection Act, as Trump threatened early in the week if governors did not take sufficient actions to quash unrest in their states.

An administration official, who also spoke on the condition of anonymity to speak candidly, said Esper had “worked incredibly hard over the last weeks and days to address the civil unrest without having to resort to this last-resort measure.” That involved coordinating with Attorney General William Barr, who is leading the law enforcement response, and requesting additional National Guard troops from governors to avoid having to use active-duty personnel, the official said.

The White House press secretary had cool remarks about Esper following his statement on Wednesday, saying he remained in his position “as of right now.” Officials said Trump was angry with Esper but was counseled not to fire him.

Like those before them, Esper has struggled at times to advance Trump’s agenda while hewing to core Pentagon priorities, such as nurturing military alliances.

Trump’s relationship with the military has been fraught from the start. The New York businessman, who avoided serving in the Vietnam War with five deferments, sought to surround himself with military brass as a sign of power. He brought retired generals into his Cabinet and the White House National Security Council, and described active-duty leaders as “my generals.”

On his first days in office, Trump dragged the uniformed force into a contentious political moment by signing a travel ban on multiple Muslim-majority countries at the Hall of Heroes in the Pentagon. Since then, he has savaged Democrats onstage in talks to troops at military installations and signed “Make America Great Again” hats on military bases.

In the run-up to the 2018 midterm elections, Trump deployed active-duty forces to the border with Mexico in what critics described as an attempt to use the military as a political prop. He took billions of dollars from the Pentagon budget that weren’t authorized by Congress to build parts of the border barrier. And he intervened in the high-profile war crimes case against former Navy SEAL Eddie Gallagher in what was seen by many at the Pentagon as a broadside against impartial military justice.

The backdrop to the recent events is the military’s effort to rebuild trust with the American public since the days of the Vietnam War. Many retired generals don’t want the American military to return to a time when it’s seen as on one side or the other in American politics.

In particular, the 1970 massacre at Kent State University, in which members of the Ohio National Guard shot into a crowd of protesters, killing four students and wounding nine others, looms large over any decision to rely on military forces to step in and replace the police. The incident led to national outrage and dealt a further blow to the reputation of the military among the American public.

Beyond what retired four-star officers such as Mattis and Mullen have said, what is more notable is what active-duty generals have said in response to the events of the past few days, said Lee, an assistant professor at the U.S. Air War College, who said she was speaking in a personal capacity and not on behalf of the military.

Milley, who faced intense criticism for appearing in camouflage next to the president as Trump made his way to St. John’s Episcopal Church on Monday, issued a memo to the U.S. military’s top leaders the following day affirming the military’s commitment to the values of the Constitution. Officials said Esper and Milley had intended to inspect damage at the church and speak with National Guard troops stationed near the White House and did not know Trump intended to stage a televised event.

“We all committed to the idea that is America,” Milley wrote by hand in the memo. “We will stay true to that oath and the American people.”

The memo came as service chiefs also issued notes regarding the events following the unrest, designed to ensure people that top generals and admirals agreed with the need for a response.

“The active duty are speaking just in the way that they can,” Lee said. “They are walking a high-wire act.”

The Washington Post’s Dan Lamothe contributed to this article.