Defense Secretary Mark T. Esper distanced himself from President Trump on Wednesday, saying the use of active-duty forces to quash unrest across the nation is unnecessary at this stage, hours before his predecessor, Jim Mattis, excoriated the president for working to divide the country.

The comments captured the extraordinary tension that has been building among current and former Pentagon officials since Monday, when Trump threatened to invoke the Insurrection Act to use active-duty troops in U.S. cities and Esper referred to American cities as a “battlespace.”

Later that day, the Pentagon began moving forces to the Washington area in preparation for possible operations in the nation’s capital, and authorities used force to clear largely peaceful protesters from Lafayette Square so Trump could walk to a damaged church and pose for photographs with a Bible.

Mattis’s blunt comments about Trump represent a break from the decorum the retired general said people who leave an administration should afford a sitting president. For two years as Trump’s defense secretary, he was seen as a voice of gravitas before quitting when Trump announced a hasty withdrawal of U.S. troops from Syria.

Mattis isn’t the first former top official in Trump’s administration to speak out against the president — former White House chief of staff John F. Kelly and former secretary of state Rex Tillerson have also denounced Trump — but his voice is perhaps the strongest, as a former general who developed a cult of personality within the military with the call sign “Chaos.”

Since resigning as defense secretary in late 2018, the retired four-star Marine Corps general has largely abstained from criticizing Trump. But the events of the past week prompted Mattis to take aim at Trump in a statement released to the Atlantic magazine.

“Donald Trump is the first president in my lifetime who does not try to unite the American people—does not even pretend to try. Instead he tries to divide us,” Mattis said in the statement. “We are witnessing the consequences of three years of this deliberate effort. We are witnessing the consequences of three years without mature leadership.”

Mattis, who served under Trump for two years, called upon Americans to “unite without him” and referred to Abraham Lincoln’s appeal to Americans in his 1861 inaugural address to summon their better angels and hold the nation together.

“We know that we are better than the abuse of executive authority that we witnessed in Lafayette Square,” Mattis said. “We must reject and hold accountable those in office who would make a mockery of our Constitution. At the same time, we must remember Lincoln’s ‘better angels,’ and listen to them, as we work to unite.”

In a Twitter message several hours after Mattis’s statement was made public, Trump called him “the world’s most overrated general.”

The criticism of the events this week represents a growing sense of dismay among retired military leaders who have warned against the domestic use of military aggression and politicization of the armed forces. Adm. Mike Mullen, former chairman of the Joint Chiefs of Staff, said conditions in U.S. cities did not warrant the deployment of active-duty military forces, and retired Army Gen. Tony Thomas, a former commander of U.S. Special Operations Command, said American soil should never be described as a “battle­space” unless invaded by a foreign power.

Esper has come under fire along with the chairman of the Joint Chiefs of Staff, Army Gen. Mark A. Milley, for their participation in the visit to the church and the deployment of 1,400 active-duty soldiers to bases near Washington, as Trump demands law and order. Esper has said he didn’t know where the group was going when Trump took his advisers across the street to the church. On Wednesday morning, Esper also addressed whether he thought the Pentagon should use active-duty troops.

“The option to use active-duty forces in a law enforcement role should only be used as a matter of last resort and only in the most urgent and dire of situations,” Esper said. “We are not in one of those situations now. I do not support invoking the Insurrection Act.”

A senior defense official rejected the notion that there was any disagreement between the secretary and Trump on the issue.

“The secretary’s comments clearly match the president’s view that these forces should only be used in dire circumstances and that fortunately due to the president’s efforts to get governors and mayors to step up their efforts, we’re not in one of those situations right now,” the official said, speaking on the condition of anonymity to talk candidly about Esper’s remarks.

The events have put Esper in a precarious position with Trump, whose threats have placed the role of the military on American streets under scrutiny and prompted officials and several retired generals to speak out.

Sen. Tammy Duckworth (D-Ill.), an Army veteran, issued a broadside on Wednesday, saying that Esper and Milley followed Trump to St. John’s Episcopal Church on Monday night “like two lap dogs carrying out this president’s really twisted idea of what the military is supposed to do.”

“He knew exactly what he was doing when he decided to support Donald Trump in this, instead of standing up to this president and saying, ‘Sir, no. You are politicizing the military. This is not the appropriate use of our military.’ Instead, he went right along with it, and that is very scary to me.”

Amid the rising tension, Esper made his first direct public comments about the killing of George Floyd, a black man whose death in police custody on May 25 ignited the nationwide protests.

“Racism is real in America, and we must all do our very best to recognize it, to confront it and to eradicate it,” he said, calling Floyd’s killing a “horrible crime.”

Esper has encouraged governors to use National Guard members in each state to assist police in quelling unrest, keeping guard members under state authority and active-duty soldiers out of the fray, defense officials have said.

But Trump has pressed the issue, pledging to use the Insurrection Act anywhere that a governor’s response isn’t to his liking.

Esper’s remarks Wednesday immediately drew attention at the White House and frustrated the president, senior administration officials said, speaking on the condition of anonymity because of the sensitivity of the issue.

The officials said that Esper met with Trump at the White House, and that Trump was counseled not to fire the defense secretary.

White House press secretary Kayleigh McEnany declined to offer an endorsement of the Pentagon chief in a briefing with reporters later in the day after Esper met with Trump.

“With regard to whether the president has confidence in Secretary Esper, I would say that if he loses confidence in Secretary Esper, I’m sure you all will be the first to know,” McEnany said.

“So, guys, as of right now, Secretary Esper is still Secretary Esper,” she added. “And should the president lose faith in him, we will all learn about that in the future.”

While the Pentagon largely stayed out of the spotlight in the first few days after Floyd’s killing, scrutiny has increased as Trump reaches for the military as a tool of choice in the unrest.

On Monday, Esper urged governors to use National Guard members at their disposal to address the situation, saying that “the sooner that you mass and dominate the battlespace, the quicker this dissipates and we can get back to the right normal.”

Hours later, Trump issued his threat in the Rose Garden to use active-duty troops, as authorities employed nonlethal weapons to clear peaceful protesters from the area just outside.

Mullen, the former chairman of the Joint Chiefs of Staff, expressed alarm about what orders Trump might give the military.

“I remain confident in the professionalism of our men and women in uniform. They will serve with skill and with compassion. They will obey lawful orders,” Mullen wrote for the Atlantic. “But I am less confident in the soundness of the orders they will be given by this commander in chief, and I am not convinced that the conditions on our streets, as bad as they are, have risen to the level that justifies a heavy reliance on military troops.”

But others have urged the president to crack down further. Sen. Tom Cotton (R-Ark.) wrote in an opinion piece Wednesday that “an overwhelming show of force” was needed to “disperse, detain and ultimately deter lawbreakers.”

“Some governors have mobilized the National Guard, yet others refuse, and in some cases the rioters still outnumber the police and Guard combined,” Cotton wrote for the New York Times. “In these circumstances, the Insurrection Act authorizes the president to employ the military ‘or any other means’ in ‘cases of insurrection, or obstruction to the laws.’ ”

Democrats in Congress and the D.C. mayor have criticized the forcible clearing of the area before Trump’s appearance at the church.

Esper, asked whether he regretted participating in the event, did not answer directly. He said he tries to stay out of events that “appear political,” adding that “sometimes I’m successful at doing that, and sometimes I’m not as successful.”

Esper also defended his use of the term battlespace during the call with governors, an audio except of which was published by The Washington Post. He characterized the term as military jargon for an area in which troops operate and said it was not intended to depict protesting Americans as an adversary or suggest a harsh response.

Anne Gearan and Alex Horton contributed to this report.