Five people were injured at a Ku Klux Klan rally in Southern California on Saturday when protesters attacked members of the white supremacist group, the police said, unleashing chaos on a popular park and leaving three people with stab wounds.

Clashes broke out as soon as members of the Klan arrived at Pearson Park in Anaheim, Calif., on Saturday, said Sgt. Daron Wyatt, a spokesman for the Anaheim Police Department. He said the group had planned to stage an anti-immigration rally with the theme “white lives matter.”

“Immediately as the K.K.K. guys got out of their vehicle they were attacked by the counter-protesters,” he said. “That soon developed into several different fights between the two groups that were spread along the length of a city block.”

A group of about 30 anti-Klan protesters spent part of the morning waiting at the park and were preparing to leave when six Klan supporters arrived, dressed in black and wearing Confederate battle flag patches sewn on their clothes, said Sergeant Wyatt.