(KRON) — A San Jose man was charged with attempted murder after he allegedly attacked his pregnant wife at home and shot a police officer who tried to help, according to the Santa Clara County District Attorney’s Office.

The female police officer’s partner dragged her out of the line of fire, likely saving her life, San Jose Police Chief Anthony Mata said.

The accused gunman, 44-year-old Gabriel Mario Carreras, is slated to make his first court appearance Friday afternoon. If convicted of the charges filed against him, Carreras could face a life prison sentence, prosecutors said.

District Attorney Jeff Rosen said, “There are too many guns in too many dangerous people’s hands. Today, an officer lies badly wounded in the hospital for trying to save a pregnant woman. As we give our sincerest thanks to her and her heroic partner, we are determined to make sure this suspect will never see a gun, or freedom, again.”

The incident happened on August 16 at 7:51 am. A pregnant woman called 911 dispatchers crying. She said her husband was drunk and assaulting her inside their condo on Auzerais Avenue, according to prosecutors.

When two police officers arrived at the scene, Carreras ambushed the officers and opened fire from a balcony, Mata said.

“Carreras came out of a balcony door and fired a gun at the officer, striking her in the abdomen, below her bulletproof vest. The bullet caused serious damage to her intestine, colon, liver, gallbladder, and fractured her spine. After her partner pulled her to safety, additional officers arrived on scene and surrounded the residence,” the DA’s Office wrote.

With his pregnant wife still inside the condo and dozens of police officers surrounding the area, Carreras barricaded himself for four hours, prosecutors said. During the standoff, Carreras passed out.

“Officers reported hearing at least two other gunshots before the victim escaped after taking the loaded weapon from the now passed out perpetrator. She told investigators that her husband had tried to punch her stomach and blamed the police shooting on her,” the DA’s Office wrote.

The injured San Jose Police Department officer remains in a hospital in critical but stable condition.

Carreras is a convicted felon who cannot lawfully possess a firearm. At his arraignment on Friday, he will face several charges that will include attempted murder of a police officer.