Videos of Tuesday’s clash outside the Turkish ambassador’s residence in Washington show a violent and chaotic scene: guards for the visiting Turkish President Recep Tayyip Erdogan charging, beating and stomping people peacefully protesting that country’s policies.

Baton-waving D.C. police officers forcefully break up the melee and separate the two sides, then turn to tend to bloodied protesters as the guards, some of them armed, retreat to the safety of their diplomatic compound.

The fracas, captured on video and widely spread in traditional and social media, sparked outrage and stern words from many U.S. politicians and calls for the ambassador’s expulsion.

D.C. police vowed to continue their investigation of the confrontation. But several law enforcement experts said it’s likely little will come of it.

Issues of diplomatic immunity would make any prosecution difficult, if not impossible, they said. And the leveling of charges might embolden other countries to ignore similar immunity agreements, putting U.S. diplomats abroad at risk. Most experts said police did the right thing, focusing on stopping the attacks and limiting the injuries.

Turkish security personnel clash with protesters outside the Turkish Embassy on Tuesday. (VOA News)

“The outcome may not satisfy everybody, but they don’t understand the intricacies of dealing with people with diplomatic immunity,” said Charles H. Ramsey, who has headed both the District and Philadelphia police departments. “Nobody is going to leave this happy, and they may not agree with the decision, but it is what it is.”

The State Department on Wednesday summoned Turkey’s ambassador for a meeting, the equivalent of a diplomatic scolding.

D.C. police arrested two men during the incident, neither affiliated with the Turkish Embassy. A State Department official confirmed two members of Erdogan’s security detail also were detained but were then released, conforming to the customs of international law that “affords heads of state and members of their entourage with inviolability from arrest and detention.”

Ramsey and some other authorities said police handled the disturbance smartly by separating the antagonists and leaving it to others to sort out culpability and criminality. He said even if the officers didn’t immediately grasp that the guards were potentially immune from arrest, they would have known that a fight outside an ambassador’s residence was more complex than a simple dispute.

“The officers in D.C. are well trained,” Ramsey said. “They are very familiar with these unique kind of circumstances. This is not your typical city.”

But Eugene O’Donnell, a former police officer and prosecutor in New York City, said the videos show that D.C. police had not adequately prepared for a potential clash and that the officers appeared “neutered and paralyzed” as they tried to restore order.

He questioned granting the Turkish security guards any leniency.

“It can’t be right that all you have to have is a suit and a lanyard around your neck and you can tear into peaceful protesters,” said O’Donnell, who teaches at the John Jay College of Criminal Justice in New York and has trained foreign police forces. “Diplomatic immunity can’t be a license to attack people at will. The cops see people beating others into submission, and I think they’re convinced it was above their pay grade to act.”

D.C. police on Friday defended their handling of the incident, saying in a statement that officers “displayed sound decision-making and professionalism.” On Wednesday, Police Chief Peter Newsham said that the situation was “very dicey” for officers because the Turkish guards carried guns, and Newsham commended the officers for stopping the melee “without more significant injury.”

The nation’s capital frequently attracts protesters, and this past year has seen more than usual, making known their views about President Trump, human rights, wars, dictators, police tactics, entanglements in far-off lands and issues closer to home. They can be tiny groups or hundreds of thousands of people taking their message to the leader of the free world. Some peaceful, some not, all are a backdrop to the District’s routine rhythm.

D.C. police and Newsham have been judged by the handling of public dissent — from the mass arrests at Pershing Park in 2002 that violated civil liberties and cost the District millions in civil settlements to January’s arrests of more than 200 during a violent disturbance during Trump’s inauguration.

Each demonstration is fraught with its own political agendas, and police are expected to assume a neutral role to allow free speech while preventing violence.

District officials said they are reviewing video from Tuesday to identify attackers and possibly obtain arrest warrants. Newsham said Wednesday that he had talked with State Department and Secret Service officials and is “very encouraged” about their cooperation. He said issues over diplomatic immunity “won’t prevent us from doing what we have to do.”

In Congress, lawmakers called for barring the guards from the United States and even for kicking the Turkish ambassador out of the country. But criminal justice experts say that is unlikely.

“I understand everybody wants justice and fairness,” said Roscoe C. Howard Jr., the U.S. attorney for the District from 2001 to 2004. “It just doesn’t work all the time.”

Howard said police exhibited proper restraint. “You start putting those guys in handcuffs,” he said, referring to the Turkish guards, “it ends up going from a local melee to an international incident.”

Howard said any decision on whether to take action must consider the greater context of international relations, such as Turkey’s cooperation in the fight against the Islamic State and its role in accepting people fleeing the war in Syria.

“It’s not what happens here,” Howard said. “It’s what happens in Turkey. . . . We tell the guards they are no longer welcome in our country, and Turkey is going to randomly pick folks from the U.S. Embassy and say they have to get out.” He said he knows it’s a raw deal for “the guy with his head bashed in or teeth missing. He’s going to feel he wasn’t given a fair shake.”

Turkey’s semiofficial news agency cast the melee as a failure of D.C. police, saying they did not stop the anti-Erdogan protest. The government later alleged that its guards had “responded in self-defense” to terrorists it said had joined the protesters.

Demonstrators denied the presence of militants and alleged that police stood by as “Turkish thugs” attacked. One video shows a man lean into a car where Erdogan was sitting, then signal to another man who then heads toward the protesters. Things quickly become chaotic, and other videos show more dark-suited men, some carrying furled red flags, kicking and punching protesters as police try to intercede. At one point, Erdogan emerges from the car and watches the scene.

W. Ralph Basham, who directed the Secret Service from 2003 to 2006, said the fact that D.C. police separated the two sides with minimal arrests appeared more a tactical decision than one born out of consideration of geopolitical ramifications.

“The security detail attack on the demonstrators was pretty speedy and violent, and the police were trying to sort it all out,” Basham said. “They tried to push people to their neutral corners, but in this case there were no neutral corners. It was total ­chaos.”

Carol Morello, Magda Jean-Louis and Perry Stein contributed to this article.