The US's top general has said he was wrong to appear with President Donald Trump in a photo op near the White House last week, staged after the area was forcefully cleared of anti-racism protesters.

"I should not have been there. My presence in that moment and in that environment created a perception of military involvement in domestic politics," General Mark Milley, the chairman of the Joint Chiefs of Staff, said of the controversial incident on 1 June.

Gen Milley's comments appeared likely to further strain the already fraught relations between US military leaders and the White House.

Relations have frayed over Mr Trump's move to involve the Pentagon in efforts to quell protests and looting around the country following the killing of African American George Floyd by a white Minneapolis police officer.

Gen Milley and Secretary of Defense Mark Esper were both strongly criticised for participating in what was widely seen as a political show by Mr Trump, who walked with officials from the White House to pose in front of St John's Episcopal Church, holding up a bible.

Minutes earlier, hundreds of peaceful protesters were forced from Lafayette Park between the White House and the church by police and National Guard troops firing smoke bombs and tear gas-like pepper rounds.

Gen Milley's presence was particularly criticised as he was wearing his camouflage battle uniform.

Normally military officials wear their formal dress uniform when holding meetings in the White House, and for many it implied Gen Milley's support for Mr Trump's stated desire to deploy active duty US troops against protesters.

In a pre-recorded video message, Gen Milley told new graduates of the National Defense University that pictures of him and Mr Esper walking with Mr Trump "sparked a national debate about the role of the military in civil society."

Mr Trump had summoned both men to the White House to discuss the extraordinary measure of using active military troops in addition to national guards to confront protestors.

Pentagon officials have said both had little time to prepare for the meeting, which caught Gen Milley in his battle uniform and Mr Esper as they were headed to a separate non-public meeting.

Nor did they know ahead of time that National Guard troops were going to clear the park using chemical munitions to force the protestors out, Pentagon officials said.

Several former holders of Gen Milley's position blasted him and Mr Esper for accompanying Mr Trump and allowing the military to be politicised.

"I am deeply worried that as they execute their orders, the members of our military will be co-opted for political purposes," said former joint chiefs chairman admiral Mike Mullen.

Two days later, Mr Esper announced that he would not support Mr Trump's desire to invoke the rarely used Insurrection Act to call up active troops to deal with the protests. 

That, according to media reports, infuriated Mr Trump who had to be convinced by White House advisors and senior politicians not to fire Mr Esper.

In his speech, Gen Milley stressed that US citizens have the constitutional right to protest peacefully.

"We should all be proud that the vast majority of protests have been peaceful. Peaceful protests mean that American freedom is working," he said.

"We in the military will continue to protect the rights and freedoms of all American people," he added.