A Sacramento police officer who was shot and seriously wounded Wednesday evening by a rifleman who blasted away at officers trying to rescue her has died, police said.

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

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.

She lay in the backyard of a home 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.

Peletta said O'Sullivan was partnered with a training officer when she was shot just before 6 p.m. He did not offer any more information.

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.

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.