PALM SPRINGS, CALIF. —Police arrested known gang member John Felix in the killing of two Palm Springs police officers Saturday afternoon.

Felix, 26, was captured alive around 12:50 a.m. Sunday morning after a standoff with police lasting 12 hours, according to the Riverside County Sheriff's Department. He is accused of two counts of murder of a peace officer.

Felix was previously sentenced to four years in prison for a 2009 attempted murder plot in which he confessed to assault with a firearm. Felix and another suspect managed to shoot their target but he didn't die. Felix was charged with attempted murder, discharging a firearm causing great bodily injury and association with a criminal street gang.

He was also arrested in 2013 for fighting with police on the same doorstep where Saturday’s shooting occurred.

Authorities say Felix killed officers Jose Gilbert “Gil” Vega and Lesley Zerebny Saturday in what witnesses described as a barrage of gunfire — the first Palm Springs officers to die in the line of duty since 1962.

Court records don't provide details of the 2009 shooting, but they do show that Felix pleaded down to assault with a firearm and admitted his gang connection. He was given a two year prison sentence for the assault and an additional two years for his gang ties. His prison term would have expired in 2013.

Vega was a 35-year veteran who chose to work an overtime shift on Saturday, Palm Springs Police Chief Bryan Reyes said in a news conference. Vega was two months away from retirement.

Zerebny, 27, had been with the department for a year and a half. She had just given birth to a baby girl four months ago.

"Today Palm Springs lost two brave officers," Reyes said, his voice shaking with emotion. "I am awake in a nightmare right now."

Gov. Jerry Brown said in a statement that the officers "were killed today doing what they do every day – protecting their community."

"We grieve with the family members, friends and fellow officers coping with this senseless tragedy," Brown said. "Anne and I join all Californians in offering our heartfelt condolences.”

Officers comfort each other after the bodies of two killed Palm Springs police officers, Leslie Zredman and Jose Vega, are carried out of Desert Regional Medical Center, October 8, 2016.