Chairman of the Joint Chiefs of Staff Gen. Mark Milley on Thursday expressed regret for accompanying President Trump during a photo-op last week at Lafayette Square amid protests, calling the decision “a mistake” – in the latest sign of friction between the White House and the military over the response to racial unrest.

Milley made the remarks during a remote video speech to graduates at National Defense University, advising young officers to “always maintain a keen sense of situational awareness.”

ESPER OPPOSES USING INSURRECTION ACT

“As senior leaders, everything you do will be closely watched,” he said. “And I am not immune.

“As many of you saw, the result of the photograph of me at Lafayette Square last week. That sparked a national debate about the role of the military in civil society,” Milley continued. “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.”

He added: “As a commissioned uniformed officer, it was a mistake that I have learned from, and I sincerely hope we all can learn from it.”

Thursday was the first time Milley addressed the visit to Lafayette Square since the incident earlier this month.

Milley did not address the issue of renaming the 10 U.S. Army bases named after Confederate generals – after President Trump made clear a day earlier he would not support such a discussion – but acknowledged the U.S. military’s “mixed record on equality.”

FILE - In this June 1, 2020 file photo, President Trump departs the White House to visit outside St. John's Church, in Washington. Walking behind Trump from left are, Attorney General William Barr, Secretary of Defense Mark Esper and Gen. Mark Milley, chairman of the Joint Chiefs of Staff.. (AP Photo/Patrick Semansky)

"We fought World War II with a racially segregated military. The Tuskegee Airmen are just one example of courageous men who fought for freedoms they themselves did not enjoy at home. Racial segregation of the armed forces ended in 1948, and today the military has come to reflect the diversity of our nation – the strength of our nation," he said.

Milley’s comments come amid tensions between top Pentagon officials – as well as retired military figures – and the president over the handling of the protests and riots surrounding the death of Minneapolis man George Floyd in police custody last month.

TENSIONS FLARE BETWEEN TRUMP, MILITARY FIGURES

Milley, amid the unrest, circulated a letter reminding military leaders about their oath to the U.S. Constitution.

"Every member of the U.S. military swears an oath to support and defend the Constitution and the values embedded within it. This document is founded on the essential principle that all men and women are born free and equal, and should be treated with respect and dignity," Milley wrote. "As members of the Joint Force – composed of all races, colors and creeds – you embody the ideals of our Constitution. Please remind all of our troops and leaders that we will uphold the values of our nation, and operate consistent with national laws and our own high standards of conduct at all times."

Part of the criticism from military officers toward the president came after Trump’s visit to St. John's Episcopal Church near the White House, after part of the church had been set on fire the night before. The visit included a photo-op where Trump held up a Bible.

Prior to that photo-op, the area around the church was forcibly cleared of protesters, though there are conflicting claims over the tactics used. Critics say tear gas was used, while the Park Police specify that they used "pepper balls" – while not denying it's a form a tear gas.

“I’m not going to say that pepper balls don’t irritate you,” spokesman Sgt. Eduardo Delgado told Vox. “I’m not saying it’s not a tear gas, but I’m just saying we use a pepper ball that shoots a powder.”

Meanwhile, the president also had pushed for active-duty military to confront rioters — which Secretary of Defense Mark Esper said he opposed.

"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 situations," Esper said. "We are not in one of those situations now. I do not support invoking the Insurrection Act.”

Instead, the National Guard was deployed across the country, a move Milley praised on Thursday.

"And I’m also proud of the response of our National Guard forces, who provided excellent support to local and state law enforcement under the control of state governors in more than 30 states across the country. We never introduced federal troops on the streets of America as a result of the combined efforts of the Guard and law enforcement at quelling the violence and de-escalating very, very tense situations," he told graduates.

Esper also took issue with the visit to the church, saying last week that he was aware that he and the president, along with a number of others, were going to the church and Lafayette Square, but "did not know a photo-op was happening" at the church before they got there. Esper stated he tries to keep himself and his department out of politics as best he can.

Fox News' Jennifer Griffin, Tyler Olson, and Ronn Blitzer contributed to this report.