A sheriff's sergeant who died during a firefight during the Borderline Bar and Grill mass shooting in Thousand Oaks, California, last month was killed by friendly fire, officials said.

Sgt. Ron Helus was hit five times by gunman Ian David Long at the bar but was ultimately killed by a sixth shot from a California Highway Patrol officer's AR-style rifle, Ventura County Sheriff Bill Ayub said at a press conference Friday.

Ventura County officer Sgt. Ron Helus. Santa Barbara County Sheriff

"This news is extremely difficult for all of us to process and understand," Ayub said.

Helus was wearing body armor during the shooting but the rifle shot penetrated the vest and struck his heart, according to the medical examiner.

"I can tell you that most body armor worn by municipal police in this country is not capable of stopping rifle ammunition," Ayub told reporters. "It’s a matter of comfort as well as fatigue for officers to wear heavy armor, day in and day out."

The highway patrol officer who fired the fatal shot was a 9-year veteran of the department and has voluntarily taken time off, according to a spokesman for the California Highway Patrol.

"The mere thought of something like this happening is devastating to all of us and underscores the difficult and dangerous circumstances law enforcement faces, often with only mere seconds to react," California Highway Patrol Commissioner Warren Stanley said in a statement.

Long, 28, the man who killed 12 people at the bar, was a machine gunner in the Marines from 2008 to 2013. He served as a corporal and was deployed in Afghanistan. Long died of a self-inflicted gunshot wound inside the bar after the attack.

Long's motive for the shooting is still unknown.