Black-clad anarchists on Sunday stormed into what had been a largely peaceful protest here against hate and attacked at least five people, including the leader of a politically conservative group who canceled an event a day earlier in San Francisco amid fears of violence.

The group of more than 100 hooded protesters, with shields emblazoned with the words “no hate” and waving a flag identifying themselves as anarchists, broke through police lines, avoiding security checks by officers to take away possible weapons. Then the anarchists blended with a crowd of 2,000 largely peaceful protesters who turned up to demonstrate in a “Rally Against Hate” opposed to a much smaller gathering of right-wing protesters.

Berkeley Police Chief Andrew Greenwood defended how police handled the protest, saying they made a strategic decision to let the anarchists enter to avoid more violence.

Greenwood said that “the potential use of force became very problematic,” given the thousands of peaceful protesters in the park. Once anarchists arrived, it was clear there would not be dueling protests between left and right, so he ordered his officers out of the park and allowed the anarchists to march in.

There was “no need for a confrontation over a grass patch,” Greenwood said.

Among those assaulted was Joey Gibson, the leader of the Patriot Prayer group, which canceled a Saturday rally and was then prevented from holding a news conference when authorities closed off the public square he planned to use. Gibson has denounced racism and said he started Patriot Prayer after several supporters of President Trump were beaten at a Trump campaign stop in San Jose last year. Authorities nonetheless feared the group’s event could attract white nationalists, as it has in the past.

After the anarchists spotted Gibson at the Berkeley park, they pepper-sprayed him and chased him out as he backed away with his hands in the air. Gibson rushed behind a line of police wearing riot gear, who set off a smoke bomb to drive away the anarchists.

Separately, groups of hooded, black-clad protesters attacked at least four other men in or near the park, kicking and punching them until police stopped the assaults. An Associated Press reporter witnessed the assaults.

Police in the San Francisco area have been bracing for violence and trying to prevent protests that draw left-wing and right-wing opponents since a deadly confrontation in Charlottesville on Aug. 12 that occurred during a rally of white supremacists.

Berkeley authorities did not issue a permit for Sunday’s gathering of right-wing protesters. Mayor Jesse Arreguin (D) had urged counterprotesters to stay away from Civic Center Park.

The right-wing event had been canceled by organizer Amber Cummings, who encouraged supporters to stay away but said she would attend on her own.

By midafternoon, Cummings had not appeared and left-wing protesters far outnumbered right-wing supporters.

Earlier in the day, police had set up barricades around the park and checked people who entered to make sure they did not have prohibited items such as baseball bats, dogs, skateboards and scarves or bandannas they could use to cover their faces.

Officers arrested 13 people, most for having prohibited items, Greenwood said.

At one point, an anti-rally protester denounced a Latino man holding a “God Bless Donald Trump” sign.

“You are an immigrant,” Karla Fonseca said. “You should be ashamed of yourself.”

Several other people also yelled at the man, who said he was born in Mexico but supports Trump’s proposal to build a wall along the southern border.

Police pulled one Trump supporter out of the park over a wall by his shirt as a crowd of about two dozen counter-demonstrators surrounded him and chanted “Nazi go home” and pushed him toward the edge of the park. At least two people were detained by officers for wearing bandannas covering their faces.

Anti-rally protesters chanted slogans “No Trump. No KKK. No fascist USA” and carried signs that said “Berkeley Stands United Against Hate.”

A separate group of counterprotesters had assembled earlier Sunday at the nearby University of California at Berkeley and then marched park to merge with the anti-rally protesters who had already gathered there.

— Associated Press