BAKERSFIELD, Calif. (KGET) — A restraining order prohibiting him from owning firearms had been issued against the man who shot and fatally wounded a deputy sheriff during an hours-long SWAT standoff at a Wasco home, authorities said.

Sheriff Donny Youngblood said the gunman was armed with an AK-47-style rifle and a handgun during Sunday’s standoff that resulted in the deaths of five people: Deputy Phillip Campas, the gunman and three others found inside the residence.

A 24-year-old man and 17-year-old male found dead in the home were the gunman’s sons, the sheriff said. The woman, 42, was their mother.

“It has the implications of what we see in law enforcement when it comes to domestic violence and how serious it is and, quite frankly, how a restraining order is not bulletproof,” an emotional Youngblood said during a press conference Monday.

“Our hearts are broken because of the loss of a star in our organization, but we also have three other victims that we are mourning from the city of Wasco,” he said.

Of those killed, only Campas, 35, was identified. Youngblood said the coroner’s office will release the other names.

Deputy Dizander Guerrero was also shot during the standoff, Youngblood said. He was treated at Kern Medical and released. Two other deputies were wounded by shrapnel.

A total of 23 deputies were on administrative leave. Some weren’t shooters, Youngblood said, but were close friends of Campas. He said SWAT members were not notified of Campas’ death until the incident was over so they could remain focused.

The sheriff’s SWAT team was inactive Monday. The Bakersfield Police Department will respond if a SWAT team is needed.

“We’re just not capable of doing it today,” Youngblood said.

The incident began around 1 p.m. when a caller reported a man armed with a gun at a home near 1st Street and Poplar Avenue. Multiple 911 calls poured in reporting people screaming.

Deputies arrived at 1:05 p.m. and a woman told them two or three people had been shot inside the home. Deputies were then shot at from someone inside the residence, Youngblood said. They took cover and called for backup.

A perimeter was established and at 1:12 p.m. the sheriff’s SWAT team arrived.

At 2:53 p.m., believing there were victims that might still be alive and in need of medical aid, a “heroic attempt” was made to remove them from the home, Youngblood said.

As they approached the front door, SWAT members came under fire from a man armed with a rifle, the sheriff said.

Campas and Guerrero were struck by gunfire and two other deputies were hit by shrapnel, Youngblood said. Campas was pulled to a safe location and given medical aid, and both he and Guerrero were taken to area hospitals. Campas was later pronounced dead.

The standoff continued, the gunman at times firing at the SWAT team, Youngblood said.

The gunman left the house at 6:28 p.m. and attempted to climb to the roof of a residence, Youngblood said. He was armed with an AK-47-style rifle and a handgun.

Deputies fired and the gunman was hit. He was pronounced dead at the scene, Younglood said.

Two women and two girls escaped the home unharmed, the sheriff said.

Campas was a five-year veteran of the department. He served in the U.S. Marines, including as a sergeant in Afghanistan in 2008.

An academy instructor and honor guard member, Campas made such an impact that Youngblood said he and others in the organization thought he’d been with the department twice as long.

“He probably touched this organization as much as anyone that I’ve ever seen in such a short time,” he said.

Campas leaves behind a wife and two children.