A police sergeant who died trying to stop a gunman after he opened fire in California bar was killed by a fellow officer’s bullet.

Sergeant Ron Helus was shot five times by Marine veteran Ian Long after he sprayed bullets into a crowd at a country music night in Thousand Oaks on 7 November, killing 12 people.

But police have revealed none of Long's bullets was responsible for Sgt Helus' death. He was in fact killed by the highway patrolman who had also rushed to help and opened fire on the gunman.

LD Maples, chief of the California Highway Patrol's coastal division said that the patrolman "had no clue" that he had been responsible.

“It surprised all of us," he said. "He’s devastated.”

The patrolman, who is currently on leave from the force, was only identified as a nine-year veteran of the department.

“We’re trying to take care of him right now,” Chief Maples added.

Police did not give any details on Long’s motive or any other update about the investigation

Sgt Helus was wearing a bulletproof vest when he was shot, but officials did not say where the bullet entered his body.

His wounds from Long’s handgun were serious, but potentially survivable, including two that hit the edge of his vest, according to the county’s chief medical examiner Christopher Young.

People comfort each other as they stand near the scene 8 November, 2018, in Thousand Oaks, California, where a gunman opened fire inside a country dance bar crowded with hundreds of people on "college night," killing 11 people including Sergeant Ron Helus, who rushed to the scene. (AP)

Most body armour worn by police officers in the United States can be pierced by bullets from an assault rifle, Ventura County Sheriff Bill Ayub said.

Stronger armour is available, often at an officer’s own expense, but many don’t like it, he said, as it can be heavy and cause fatigue.

Mr Ayub said the revelation that Sgt Helus was killed by a fellow officer did not diminish the heroism shown by both men, and that no one was to blame but the gunman himself.

“He went there with a plan and a purpose and that was to take innocent lives,” he said. “The burden lies solely with him, not with those who tried to save lives.”

A family photo shown during a video montage of Ventura County Sheriff Sgt. Ron Helus with his wife Karen and son Jordan years ago. Sgt. Helus was one of twelve victims of the Borderline Bar & Grill mass shooting in Thousand Oaks, California, on 7 November, 2018. (EPA)

Long threw smoke grenades into Borderline Bar and Grill in Thousand Oaks, 40 miles northwest of Los Angeles, at 11.20pm local time on 7 November and began firing into a crowd of about 200 people.

He used a flashlight with a laser sight attached to his .45-caliber semi-automatic pistol as he fired.

Panicked revellers ran for the doors, dived under tables and piled on top of each other in an effort to dodge the gunfire.

Others ran for their lives through other exits or broke through windows and jumped out, injuring themselves in the flight.

Long, a Marine veteran, took a tactical position and lay in wait for the officers.

Sgt Helus, a 29-year veteran of the department, was close to retirement when he was killed.

He is survived by a wife and son.