A plea bargain for Thomas McDonald was agreed upon Tuesday morning.
The agreement comes after a nearly two-year-long saga of ups and downs through the court system.
Tuesday was scheduled to be the third day of McDonald's trial when the announcement was made.
McDonald admitted to investigators he killed 54-year-old Karl Bradshaw and 84-year-old Ralph Torborg with an ax on Feb. 28, 2012.
Investigators said McDonald, who has a history of mental health issues, went on a rampage in his Mountain Gate neighborhood after he thought someone stole his medication.
Bradshaw, who worked across the street from McDonald's home was an innocent bystander and was sitting in his truck when he was attacked.
After attacking Bradshaw, McDonald then set his truck on fire.
Torborg was McDonald's neighbor.
Before his trial McDonald was deemed mentally incompetent to understand what was going on around him in court and spent time at a mental health facility in Napa.
However after spending time there he was believed to be ready for trial.
But on Tuesday attorneys said that was not the case.
McDonald was sentenced to 50 years to life in a state hospital where he will seek treatment for his mental health problems.
"I believe in this case the live testimony from some of the witnesses changed the prosecutor's opinion and my opinion of the nature of the case and gave us a fuller picture of how serious the mental illness problems of Mr. McDonald are," explained defense attorney Adam Ryan outside the courtroom.
"He is anxious to get to the facility where he is going to be in, possibly for the rest of his life and start treatment," he continued.
Outside the courthouse, Tony Grant, Bradshaw's nephew said his family is let down by the bargain.
"We're somewhat disappointed," said Grant.
His family has lived through the nightmare of the case.
"One of the things we really wanted was assurance that Mr. McDonald would never be on the streets again. We don't feel like we got that but it is a possibility," explained Grant.
Deputy District Attorney Craig Omura said he empathizes with the victim's families but said without the bargain there was the possibility of a lesser verdict.
"They'll never get closure."
"To make sure the public is protected for as long as possible the District Attorney felt that this was overall the best resolution," said Omura.
Bradshaw's family believes the case goes deeper than just McDonald, who has an extensive criminal history.
In April 2012 the family spoke on the steps of the California State Capitol.
They were part of rally for victims of violent crimes, condemning AB 109 and the early release of criminals.
The event drew the attention from dozens of lawmakers even Gov. Jerry Brown who spoke to the large crowd.
And nearly two years later, Grant, who works within the Department of Corrections, said he's done his research and McDonald should've never been a free man.
"He's been shown to be violent and unstable and from everything I can see he should not have been on the streets at the time that this happened. The system in the state of California has let it's people down and that's what needs to change."
McDonald will be back in court Feb. 24 where attorneys will discuss which mental hospital he will be sent to.