During the turbulent summer of 2020, President Donald J. Trump raged at his military and legal advisers, calling them “losers” for objecting to his idea of using federal troops to suppress outbreaks of violence during the nationwide protests over the police murder of George Floyd.

It wasn’t the only time Mr. Trump was talked out of using the military for domestic law enforcement — a practice that would carry profound implications for civil liberties and for the traditional constraints on federal power. He repeatedly raised the idea of using troops to secure border states, and even proposed shooting both violent protesters and undocumented migrants in the legs, former aides have said.

In his first term in office, Mr. Trump never realized his expansive vision of using troops to enforce the law on U.S. soil. But as he has sought a return to power, he has made clear that he intends to use the military for a range of domestic law enforcement purposes, including patrolling the border, suppressing protests that he deems to have turned into riots and even fighting crime in big cities run by Democrats.

“In places where there is a true breakdown of the rule of law, such as the most dangerous neighborhoods in Chicago, the next president should use every power at his disposal to restore order — and, if necessary, that includes sending in the National Guard or the troops,” Mr. Trump said at a conservative conference in Dallas in August 2022, shortly before announcing that he was running to be that next president.

During his time out of power, allies of Mr. Trump have worked on policy papers to provide legal justifications for the former president’s intent to use the military to enforce the law domestically — particularly on immigration. In public, they have talked about this in the context of border states and undocumented immigrants. But an internal email from a group closely aligned with Mr. Trump, obtained by The Times, shows that, privately, the group was also exploring using troops to “stop riots” by protesters.

While governors have latitude to use their states’ National Guards to respond to civil disorder or major disasters, a post-Civil War law called the Posse Comitatus Act generally makes it a crime to use regular federal troops for domestic policing purposes.