A St. Paul man pleaded guilty to murder Friday in the brutal stabbing deaths of two people in a sober home while he was in the throes of mental illness, claiming voices in a TV told him to do it.

Joseph Sandoval, 34, pleaded guilty to two charges of second-degree murder with intent on Friday. With the plea, he could earn consecutive prison sentences and could have future charges enhanced.

Prosecutors allege that Sandoval had taken fentanyl in 2022 before stabbing 56-year-old Jon Wentz and 40-year-old repairman Jason Murphy.

Ramsey County District Judge Joy Bartscher accepted the plea and reviewed prosecutors' evidence against Sandoval, stating that jurors would have enough evidence to find him guilty if he did go to trial.

Sandoval entered a Norgaard plea, which "allows a defendant to accept the consequences of their actions even though they are unable to provide a factual basis due to drug use or mental health impairment at the time," according to the Ramsey County Attorney's office.

"This tragic case is a heartbreaking reminder of the limits our mental health system faces when addressing the needs of those with profound mental illness in the justice system who are found incompetent to stand trial but do not receive adequate treatment or supervision," County Attorney John Choi said in a statement.

"Continuing to improve the connection between these two systems demands further legislative effort and funding. Our hearts go out to the Wentz and Murphy families who have suffered so profoundly due to these shortcomings."

Police arrested Sandoval on Oct. 22, 2022, after a man at a St. Paul intersection frantically reported a murder in his sober home. According to evidence reviewed in court Friday, that man lived in the home but was away for treatment. He had returned around 4:15 p.m. but said Sandoval had barricaded the entrance. Sandoval stopped the man from entering and said there was a mess inside. The man said he saw cuts and blood on Sandoval's face and that his eyes "looked crazy."

When the man entered through a side door, he found a trail of blood leading to Murphy's body. The man yelled and tried to run upstairs but was stopped by Sandoval. Prosecutors said they believe Sandoval struck the man and tried to detain him while saying he "needed help getting rid of a body."

The man escaped and asked pedestrians for help, bringing police to the scene.

Officers found Sandoval nearby with bloody clothes and cuts on his hands and face. He admitted to using fentanyl and told officers that the voices in the TV had told him to kill Murphy and Wentz.

Sandoval later asked hospital staff to handcuff him and shackle his legs to the bed "because I don't know what I'll do."

"I was hearing noises. The TV kept saying take your opportunity, so I took my opportunity," he told officers that day, according to charging documents. "The TV said they were gonna kill me and told me to take the opportunity."

An autopsy determined Murphy and Wentz were stabbed to death. Wentz suffered "significant" facial injuries, and police found a hammer and knife nearby.

On Friday Sandoval claimed to have foggy memory of the killings but said he understands that pleading guilty will bring prison time. Defense Attorney Baylea Kannmacher said Sandoval's mental health has improved as he's taken prescribed medications and visited a mental health worker in jail.

A mental health evaluation found that Sandoval was competent to stand trial Friday, but his struggles with mental health and violence began years before.

According to the County Attorney's Office, Sandoval was under civil commitment in Hennepin County before killing Murphy and Wentz. He had been charged with several violent offenses, including first-degree burglary and assault, but a Hennepin County judge found him incompetent to stand trial in 2021.

A month later, Sandoval was committed to the Anoka Metro Regional Treatment Center but was transferred to the sober home managed by Evergreen Recovery on Oct. 22, 2022 — the day he killed Murphy and Wentz.

Bartscher scheduled a sentencing hearing for July 19.