The top US military officer says he was wrong to have joined President Donald Trump during his controversial walk to a damaged church near the White House.
The 1 June event created "a perception of the military involved in domestic politics", Gen Mark Milley said.
Mr Trump walked to the church and held up a Bible after a peaceful protest at the death of African American George Floyd was forcibly dispersed.
The use of troops to tackle the protests has provoked fierce US debate.
Mr Trump has regularly referred to "law and order", calling in the National Guard to the US capital, vowing to deploy the military to other cities and condemning violent protests.
Some of the initial protests following the death of George Floyd in Minneapolis last month turned violent with looting in several cities.
But since four police officers were charged in connection with the death, the protests have been mostly peaceful, spawning an international movement against police brutality and racial inequality.
Video footage of the death in Minneapolis shows a white officer kneeling on Mr Floyd's neck for nearly nine minutes.
What did Gen Milley say?
The chairman of the joint chiefs of staff was speaking in a video for a National Defense University commencement ceremony.
He said: "I should not have been there. My presence in that moment and in that environment created a perception of the military involved in domestic politics.
"As a commissioned uniformed officer, it was a mistake that I have learned from, and I sincerely hope we all can learn from it."
The general was wearing battle uniform as he walked with the president and critics said this suggested his support for the deployment of the military against protesters.
Defence Secretary Mark Esper was also on the walk and, although he has not said he was wrong to be there, suggested in a news conference that he thought the walk was for a different purpose of mingling with troops and inspecting damage.
Senior officials told US media that Mr Trump had yelled at Mr Esper after the conference. The president has yet to respond to Gen Milley's comments.
What happened on the day?
A peaceful demonstration was cleared in Lafayette Square next to the White House with pepper spray and flash-bang grenades so that the president and his entourage could walk to St John's Episcopal Church.
Its basement had been burned the previous day.
Mr Trump, who sees himself as a champion of evangelical and conservative voters, held up a Bible outside the church.
A number of religious leaders criticised his actions. The presiding bishop of the the Episcopal Church, Michael Curry, accused Mr Trump of using the church for "partisan political purposes".
Mr Trump said "most religious leaders loved" his visit to the church and denied having any role in dispersing protesters beforehand.
His latest tweet on the issue on Thursday again praised the security forces.
More on George Floyd's death
US protests timeline
25 May 2020
George Floyd dies after being arrested by police outside a shop in Minneapolis, Minnesota. Footage shows a white officer, Derek Chauvin, kneeling on Mr Floyds neck for several minutes while he is pinned to the floor. Mr Floyd is heard repeatedly saying "I cant breathe". He is pronounced dead later in hospital.
Four officers involved in the arrest of George Floyd are fired. Protests begin as the video of the arrest is shared widely on social media. Hundreds of demonstrators take to the streets of Minneapolis and vandalise police cars and the police station with graffiti.
Protests spread to other cities including Memphis and Los Angeles. In some places, like Portland, Oregon, protesters lie in the road, chanting "I cant breathe". Demonstrators again gather around the police station in Minneapolis where the officers involved in George Floyds arrest were based and set fire to it. The building is evacuated and police retreat.
President Trump blames the violence on a lack of leadership in Minneapolis and threatens to send in the National Guard in a tweet. He follows it up in a second tweet with a warning "when the looting starts, the shooting starts". The second tweet is hidden by Twitter for "glorifying violence".
A CNN reporter, Omar Jimenez, is arrested while covering the Minneapolis protest. Mr Jimenez was reporting live when police officers handcuffed him. A few minutes later several of his colleagues are also arrested. They are all later released once they are confirmed to be members of the media.
Derek Chauvin charged with murder
Former Minneapolis police officer Derek Chauvin, 44, is charged with murder and manslaughter. The charges carry a combined maximum 35-year sentence.
Violence spreads across the US on the sixth night of protests. A total of at least five people are reported killed in protests from Indianapolis to Chicago. More than 75 cities have seen protests. At least 4,400 people have been arrested. Curfews are imposed across the US to try to stem the unrest.
President Trump threatens to send in the military to quell growing civil unrest. He says if cities and states fail to control the protests and "defend their residents" he will deploy the army and "quickly solve the problem for them". Mr Trump poses in front of a damaged church shortly after police used tear gas to disperse peaceful protesters nearby.