BAKERSFIELD, Calif. (KGET) — A 77-year-old woman has pleaded no contest to voluntary manslaughter after admitting she shot and killed her lifelong friend at a Bakersfield retirement home to end her suffering.

Sandra Bonertz, who entered the plea Thursday morning and will be sentenced to 10 years in prison next month, said she killed roommate Winnie Smith, 83, at Smith’s request due to ongoing severe pain from a recent car accident. A charge of first-degree murder was dismissed.

Prosecutors said the investigation found Smith — Bonertz’s friend of 50 years — decided she no longer wished to live and had contacted at least one other person to help end her life. That person declined.

“The lifelong friendship of Bonertz and Smith, Bonertz’s lack of criminal history, and the request of Smith to end her life were considerations in reaching the negotiated disposition . . .,” Assistant District Attorney Joseph Kinzel said in a news release.

Bonertz’s defense lawyer, Jano Mattaeo of the Public Defender’s office, said the two had made a suicide pact that ultimately ended with one dead and the other facing the possibility of life in prison.

“There are no winners in this situation,” he said. “They knew no one else but each other. They were each other’s rock, support, friend, loved one, family and they made a pact because of health situations, life, and unfortunately one went and the other didn’t get to fulfill her part.”

He added, “She now has to live with the loneliness and grief.”

Kinzel stressed Bonertz’s actions, while apparently carried out with a sense of compassion, were still criminal.

California law does not allow “mercy killings” by gunshot. They also can’t be conducted by close friends or family.

The state’s “End of Life Option” provides a series of checks and balances — including consultations with doctors and mental health professionals — to make sure a terminally ill person who wishes to die is fit to make that decision and aware of alternatives.

If they choose to die, the patient is given life-ending medication by a doctor which they take themselves.

“To prevent abuses, the law provides for end-of-life care only in very specific, narrow circumstances, under the care of a doctor, and only with safeguards in place that must be diligently followed,” District Attorney Cynthia Zimmer said in the release. “A friend or family member who takes the life of another, even if out of a belief that it is a merciful act, does so in direct violation of criminal homicide laws.”

A caregiver discovered Smiths’ body on July 11 in the room they shared at Pinewood Glen Retirement Community. Bonertz told police Smith “asked me to do it, and I did,” according to court filings.

Police found a revolver underneath a comforter on Bonertz’s bed, the filings say. It contained five rounds of .38 caliber ammunition, three of which were spent.

Smith was shot three times in the chest, the filings say.

Another resident told police Smith severely hurt an ankle in a car accident and needed help getting in her wheelchair, according to the filings. The resident said Smith was unhappy with her doctors and had been depressed.