CNN  — 

President Donald Trump came close to firing Secretary of Defense Mark Esper last week following their dispute over Trump’s threat to use active-duty troops to quell large-scale protests across the United States, several officials told The Wall Street Journal.

The officials told the Journal that allies and advisers on Capitol Hill talked Trump out of the move after he asked their opinion about the disagreement. Esper, some of the officials said, had made his own preparations to resign – including preparing a resignation letter – but was convinced by aides not to go forward with it.

An administration official familiar with the matter confirmed to CNN Wednesday that Esper contemplated resigning following the public break with Trump over the response to protests.

The source said, Esper was aware the President was angry enough to potentially fire him. Esper strongly opposed the President’s notion that active duty troops might need to be called in, believing there were sufficient National Guard forces.

When asked, a Pentagon press spokesman said there was “no information” on the issue of Esper contemplating resignation.

The revelations underscore the shaky ground Esper has been on since declaring last week that active-duty troops should be used in a law enforcement role only as a last resort.

Speaking from the Pentagon briefing room podium, Esper noted that “we are not in one of those situations now,” distancing himself from Trump’s threat to deploy the military to enforce order.

“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. We are not in one of those situations now. I do not support invoking the Insurrection Act,” he told reporters, referring to an 1807 law that allows a president to deploy the US military to suppress civil disorder.

CNN previously reported that Esper’s comments went over poorly at the White House, where his standing was already viewed as tenuous, multiple people familiar with the matter said.

In a briefing last week, White House press secretary Kayleigh McEnany would not directly answer whether Trump still had confidence in Esper, saying instead, “As of right now, Secretary Esper is still Secretary Esper.”

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

“Should the President lose faith, we will all learn about that in the future,” she added.

The tension came after defense officials told CNN that there was deep and growing discomfort among some in the Pentagon even before Trump announced that he was ready to deploy active-duty forces if local leaders failed to ramp up enforcement efforts.

As tear gas wafted through the air in Lafayette Square across from the White House, Trump announced from the Rose Garden that if state or city leaders refused “to take the actions that are necessary to defend the life and property of their residents,” he would invoke the Insurrection Act.

The threat prompted an unprecedented revolt from the elite corps of ex-military leaders, including Defense Secretary James Mattis, who said in a statement that 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. We are witnessing the consequences of three years of this deliberate effort. We are witnessing the consequences of three years without mature leadership.”

CNN’s Zachary Cohen, Kaitlan Collins, Kevin Liptak, Vivian Salama and Jim Acosta contributed to this report.