(CNN) More than a dozen protesters were arrested Sunday during confrontations that broke out amid largely peaceful protests in Berkeley, California, authorities said.

A "Rally Against Hate" was organized to protest a planned anti-Marxist gathering in the Bay Area city, home of the University of California, Berkeley.

Even though the right-wing gathering was canceled, thousands of protesters from both the left and the right showed up, CNN affiliate KGO reported.

The crowd was orderly but robust, with protesters chanting "No Trump, no KKK, no fascist USA." Skirmishes occurred "when several dozen left-wing protesters surrounded and shouted at a handful of right-wing demonstrators," CNN affiliate KPIX reported.

The left-wing presence, which included anarchists and anti-fascist demonstrators, outnumbered the right-wing showing.

At least 13 people were arrested on charges ranging from assault with a deadly weapon to violations of the city code.

CNN affiliate KRON reported at least one arrest of a man who claimed he was detained because he was wearing a mask. Many black-clad anarchist demonstrators wear masks at protests to conceal their identities.

Police want to know whether other crimes occurred during the Sunday protests and are continuing to investigate incidents that day.

One officer was injured during an arrest, police said, and others were hit with paint. Paramedics treated six people and transported two of them to hospitals, police said.

"I applaud the more than 7,000 people who came out today to peacefully oppose bigotry, hatred and racism that we saw on display in Charlottesville," Berkely Mayor Jesse Arreguin said on his Facebook page.

"However, the violence that a small group of protesters engaged in against residents and the police, including throwing smoke bombs, is unacceptable. Fighting hate with hate does not work and only makes each side more entrenched in their ideological camps."

Arreguin said he regrets the injuries but is "glad that serious violence was averted." He praised the city's police and fire departments.

"Thanks to the thousands of people who peacefully and creatively exercised their right to freedom of speech and assembly. Our nation is deeply divided, but Berkeley will forge onward to protect immigrants, people of color and others who are marginalized, and to continue to peacefully stand up for justice," the mayor said.

Berkeley is a hotbed of political protest and UC Berkeley is where the free-speech movement started in the 1960s.

Law enforcement geared up for disturbances in light of the deadly violence that erupted during the white supremacist rally earlier this month in Charlottesville, Virginia.

In April, at least 21 people were arrested as Trump supporters and opponents clashed at a park in Berkeley, police said. Eleven people were injured, with seven transported to the hospital, police said.

In February, protests that erupted at UC Berkeley ahead of a planned appearance by right-wing commentator Milo Yiannopoulos caused $100,000 worth of damage to the campus, the school said. The university blamed "150 masked agitators" for the unrest, saying they had come to campus to disturb an otherwise peaceful protest.

Over the weekend, a conservative anti-government group called Patriot Prayer had scheduled a rally for Saturday in San Francisco's Crissy Field, a popular park near the Golden Gate Bridge. A permit was issued for the rally and the city banned firearms and helmets, among other items, and planned a large police presence.

But on Friday night, organizer Joey Gibson said he was canceling the event, fearing violence. He blamed San Francisco Mayor Ed Lee and House Minority Leader Nancy Pelosi, whose district includes the city, for categorizing the group as white extremist and raising tensions. Even with that counterprotesters turned out in San Francisco on Saturday.