A gunman was arrested Thursday morning after killing a Sacramento police officer who was responding to a domestic dispute just months after she graduated from the police academy, police said.

Officer Tara O’Sullivan, 26, left the academy in December and was nearing the end of her training, Deputy Chief Dave Peletta said in a news conference Thursday morning. The slaying comes just six months after another recent graduate of the Sacramento Police Academy, Natalie Corona, was killed in nearby Davis, Calif.

“She gave her young life while protecting our community,” Peletta told reporters. “There are no words to convey the depth of sadness we feel or how heartbroken we are for the family of our young, brave officer.”

A friend of the O’Sullivan family has started a GoFundMe campaign to raise money to cover funeral expenses and related costs.

O’Sullivan was among the group of officers, including her training officer, who responded Wednesday evening to a domestic dispute. They were standing by while a woman gathered belongings from a house when a man opened fire with what police believed to be a rifle.

She was shot just after 6 p.m., but because the gunman continued firing, emergency responders could not get her to a hospital until an armored vehicle arrived 45 minutes later, police said.

O’Sullivan died at the UC Davis Medical Center. Peletta said at the news conference he could not comment on whether she could have been saved had she arrived at the hospital sooner.

The gunman continued firing sporadically as officers surrounded the building. Police said five other officers fired back and have been placed on administrative leave, according to the department’s protocol.

A police negotiation team later arrived and the shooter surrendered and was arrested just before 2 a.m. No other officers were reported injured.

Police identified the suspected shooter as 45-year-old Adel Sambrano Ramos, booked Thursday morning on charges related to O’Sullivan’s killing. The Sacramento Bee reported that Ramos has a long history of domestic violence and battery against women.

Sacramento Mayor Darrell Steinberg offered his condolences to O’Sullivan’s family at the conference after the arrest.

“As a father of a 25-year-old daughter," he said, "I grieve with you. As mayor of the city Tara was sworn to protect, we are heartbroken and we are here for all of you every step of the way.”

Steinberg said it had been 20 years since the city’s police department had lost an officer in the line of duty, but he drew an immediate connection to the January killing of Corona, a 22-year-old rookie officer who was in the police academy class just before O’Sullivan’s and was slain after just five months on the job in neighboring Davis.

Peletta said O’Sullivan’s previous captain told him she had “one of these bubbly personalities but was always just willing to help."

“What an incredible role model,” he said. "I hope she’s remembered for that, and it inspires other young women to choose not just careers in public service but careers in law enforcement, because it’s a proud profession.”

Sacramento City Council member Angelique Ashby said she and the mayor had spoken with some of O’Sullivan’s academy classmates, several of whom told them the same story about the young recruit holding a 30-minute plank, a testament to her toughness.

“I wouldn’t want any young girls to walk away thinking that this happened because she was a woman," Ashby said. "This will increasingly happen to women because women are joining the police force in increasing numbers.”

She added: “There was no one more fit or ready than Tara O’Sullivan to represent the city of Sacramento and our fine police department tonight. This had nothing to do with her being a woman. It had to do with her being a hero.”

Read more:

72 Philadelphia police officers pulled off the street amid probe into racist Facebook posts

A Trump supporter was arrested after smacking a reporter’s phone. ‘MAGA,’ a GOP lawmaker responded.

He told women he could help. Instead, he branded them with his initials and made them sex slaves.