The group of more than 100 hooded protesters, with shields emblazoned with the words "no hate" and waving a flag identifying themselves as anarchists, busted through police lines, avoiding security checks by officers to take away possible weapons.

Black-clad anarchists on Sunday stormed into what had been a largely peaceful Berkeley protest 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.

Demonstrators clash as as they beat up a man during counter protest against white supremacist at MLK Park in Berkeley, Calif., on Aug. 27, 2017.

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 "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 Gibson planned to use.

Gibson has denounced racism and said he launched Patriot Prayer after several supporters of President Donald Trump were beaten at a Trump campaign stop in San Jose, California, 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 held in the air. Gibson rushed behind a line of police wearing riot gear, who set off a smoke bomb to drive away the anarchists.