Protesters attacked two undercover California Highway Patrol officers who were attempting to infiltrate a demonstration against police brutality in Oakland after they were outed, reports the San Francisco Chronicle.

When the protesters called the two men out as law enforcement officers, a man punched the shorter officer in the back of the head and ended up struggling with him on the ground, said Avery Browne, chief of CHP's Golden Gate Division.

The crowd of "about 30 to 50" continued to advance, and the officer "transitioned from his baton to his firearm," according to Browne. He then pointed the gun at the protesters and panned the crowd to keep them away from him and his partner, who was still on the ground fighting with an attacker. A woman then kicked the officer in the head. The officer suffered head injuries and is displaying concussion-like symptoms.

"'Chief, I didn't know if I was going to make it out of this thing alive,'" Browne said the other officer told him. "'They were coming after us, they had already punched my partner in the head. I didn't know if we were going to make it out alive.'"

Browne said the agency and other police departments have had plainclothes officers dressed in protester attire walking in these marches since the first demonstration Nov. 24, and he said they will continue to employ this tactic despite Tuesday's incident.

He said before the officers were outed Tuesday, they were able to collect enough information to prevent four more freeway shutdown attempts.