A man and woman watch as law enforcement officers surround a home where a gunman has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)

SACRAMENTO, Calif. (AP) — Sacramento police on Thursday were trying to negotiate the surrender of a gunman suspected of killing a police officer during a domestic dispute.

Tara O'Sullivan, 26, died at UC Davis Medical Center hours after the gunman opened fire on her Wednesday, Deputy Chief Dave Peletta said during a news conference.

Several officers were on a domestic disturbance call, helping a woman collect her belongings and leave a home in the north Sacramento neighborhood, when the officer was wounded, Sgt. Vance Chandler said. The other woman wasn't hurt, and the relationship between her and the gunman wasn't immediately known.

Peletta said O'Sullivan was partnered with a training officer when she was shot just before 6 p.m.

O'Sullivan was in a backyard and officers couldn't reach her because the gunman kept firing, Chandler said.

"Our officers maintained cover in safe positions until we were able to get an armored vehicle in the area," he said.

It took more than 45 minutes to get her to the hospital, he said.

The rifleman kept shooting for at least two hours and as of late Wednesday night, Chandler said negotiators hadn't been able to contact him.

Heavily armored police from several agencies swarmed the residential neighborhood, where a couple dozen marked and unmarked police cars had gathered.

Police warned residents by loudspeaker to stay out of the area near the intersection of Redwood Avenue and Edgewater Road. Police were keeping media and onlookers out of sight of the scene.

According to city records, O'Sullivan had been working for the city since January 2018, The Sacramento Bee reported. She was part of the first class of graduates of Sacramento State's Law Enforcement Candidate Scholars program in 2017 and went on to the Sacramento Police Academy.

A law enforcement officer mans a barricade near a home that authorities have surrounded where an armed suspect has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)
A woman watches as law enforcement officers surround a home where a gunman has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)
A Sacramento Police officer responds to the shooting of a fellow officer in Sacramento, Calif., Wednesday, June 19, 2019. (AP Photo/Rich Pedroncelli)
Sacramento Police officers respond to a home that authorities have surrounded where a gunman has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)
A Sacramento Police officer puts up crime scene tape near a home that authorities have surrounded where a gunman has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)
A law enforcement officer climbs into a tactical vehicle during a standoff with an armed suspect who has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)
A Sacramento Police vehicle passes a roadblock near a home that authorities have surrounded where an armed suspect has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)
A law enforcement officer mans a barricade near a home that authorities have surrounded where an armed suspect has taken refuge after shooting a Sacramento police officer, Wednesday, June 19, 2019, in Sacramento, Calif. (AP Photo/Rich Pedroncelli)
Sacramento police officers respond to a shooting on Redwood Avenue in the Noralto neighborhood, Wednesday, June 19, 2019, in Sacramento, Calif. (Paul Kitagaki Jr./The Sacramento Bee via AP)
Sacramento County Sheriff's Department deputies talk, Wednesday, June 19, 2019, on Grove Avenue in Sacramento, Calif., where an armed subject fired on police officers. (Daniel Kim/The Sacramento Bee via AP)