U.S. President Donald Trump on Wednesday faced opposition from both the incumbent and his former defense chief over an idea to deploy the military to quell widespread civil unrest sparked by the death of a black man at the hands of the police.

"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," Defense Secretary Mark Esper said at a press conference.

His predecessor Jim Mattis, who has refrained from explicitly criticizing Trump since he resigned in December 2018 in protest at U.S. policy in the Syria conflict, also warned Trump that "militarizing" the government response would set up a "false conflict" between the military and civilians.

Secretary of Defense Mark Esper speaks as U.S. President Donald Trump listens during the daily White House coronavirus press briefing April 1, 2020 in Washington, DC. (Getty/Kyodo)

"We do not need to militarize our response to protests. We need to unite around a common purpose. And it starts by guaranteeing that all of us are equal before the law," Mattis said in remarks published online in U.S. magazine The Atlantic.

Trump was likened to an authoritarian leader when he suggested Monday that he could invoke a centuries-old law to deploy the military to U.S. streets with the aim of clamping down on violence that has accompanied the protests. He floated the possibility should states and cities refuse to take tough action.

Domestic order is usually maintained by the police and on occasion by troops under the authority of the National Guard, largely made up of civilians who can be mobilized by state governors to respond to natural disasters and other emergencies.

But the 1807 Insurrection Act allows the president to call in the armed forces for domestic law enforcement activities under certain circumstances, such as to suppress an insurrection.

The act was last invoked in 1992 amid rioting in Los Angeles over the acquittal of a group of white police officers accused of the roadside beating of black man Rodney King, with the incident caught on video and later broadcast on television networks.

"I've always believed and continue to believe that the National Guard is best suited for performing domestic support to civil authorities in these situations in support of local law enforcement," said Esper, himself a former member of the armed forces.

"I do not support invoking the Insurrection Act," he added.

Trump said in a TV interview that was aired later in the day that "it depends" whether he will decide to send military troops to any city. But he added, "I don't think we'll have to."

Trump and his administration have also taken flak for a decision to forcibly remove protesters to clear a path for the president to walk to, and hold a photo opportunity at, a historic church near the White House.

In the photo opportunity, Trump held a bible aloft in his right hand while standing in front of the church which was partially burned during protests the night before.

Esper, who accompanied Trump to the church along with other senior administration officials, insisted that he knew nothing in advance about the plan other than the intention to review the damage at the church and to a nearby park.

"I was not aware that a photo op was happening," he said, adding that, while he has tried to stay out of situations that may appear political, he sometimes is not "successful."

Trump suggested in a Fox News Radio interview that he had nothing to do with the removal of the protesters, saying, "When I went, I didn't say, 'Oh, move them out.' I didn't know who was there."

Just before Trump walked across the street from the White House toward the church, live footage showed the crowd dispersing after what appeared to be tear gas was fired toward them. Some were seen pouring liquid on their faces to rinse out their eyes.

Police later released a statement arguing that officers did not use tear gas, but rather smoke canisters and pepper balls.

They also said the action was taken because many protesters "became more combative, continued to throw projectiles, and attempted to grab officers' weapons," contending that the demonstration had escalated into violence.

Protests have spread all across the country, with people demanding an end to endemic racism and unjust police practices following the alleged murder of George Floyd by white police officer Derek Chauvin on May 25 in the Midwest state of Minnesota.

In video footage that quickly spread across social media, Floyd, 46, was seen gasping for air while Chauvin knelt on his neck for nearly nine minutes after his arrest for allegedly using a counterfeit bill. He was pronounced dead shortly afterward.

Chauvin, at the time of the killing a member of the Minneapolis Police Department, was fired and charged with third-degree murder. Prosecutors on Wednesday upgraded the charge to second-degree unintentional murder and said they have also charged three other officers who were on the scene for allegedly aiding and abetting murder.

Related coverage:

Biden raps Trump over racial unrest in heated election campaigning

Naomi Osaka condemns racial injustice as other Japanese athletes add voices

Peruvian man sues state over assault while detained in Osaka