WILMINGTON, Del. — A former honors student who has wrestled with mental health issues since he was a child pleaded guilty but mentally ill Friday in the fatal stabbing of a psychiatrist who once treated him.

Christopher Frick, 22, who is to be sentenced Nov. 18, faces a mandatory term of life in prison without parole for first-degree murder. He also pleaded guilty to possession of a deadly weapon during the commission of a felony. Prosecutors dropped three other charges.

The plea means Frick will spend the rest of his life behind bars but will also receive psychiatric treatment while incarcerated, either at the state psychiatric center or at a maximum security prison.

Frick was charged in the October 2015 killing of Caroline Ekong, 55, who was found dead in her home shortly before Frick called 911 from his parents’ home to report that he had killed her.

Three mental health experts concluded in separate reports that Frick suffers from a host of mental disorders, including autism spectrum disorder, psychosis, schizophrenia and obsessive-compulsive disorder.

Superior Court Judge Ferris Wharton nevertheless found that Frick, who graduated with honors from high school and studied physics at the University of Delaware, was competent to enter the plea.

Frick told Wharton that he is currently taking Prozac, which helps his depression, and Zyprexa, an anti-psychotic.

“Before, I was hearing a lot of aggressive voices in my head,” Frick said.

Public defender Kathryn van Amerongen said after the hearing that Frick understands what he did was wrong and that he needs to be punished. Frick has dedicated his life to Christianity, she added.

“He studies the Bible every day,” she said, adding that Frick also reads math and physics books to occupy his time.

“He’s somebody who played blindfolded chess,” Amerongen noted.

Amerongen said Ekong’s death was a crime “born of mental illness.” She said Frick was so against violence that he would not eat meat, and that he would watch a spider for hours at a time instead of kill it.

Frick first met Ekong three years before her death when he was taken to Rockford Center, a private psychiatric facility in Stanton, after experiencing what Amerongen described as a “crisis” at the university.

Frick became angry after Ekong refused to let him leave the Rockford facility. Authorities have said he plotted her death for at least a year.

Amerongen said Frick, who began seeing doctors at the age of 4 or 5, was hearing voices in his head “mocking him for not having the nerve to kill her.”

On Oct. 14, Frick broke into Ekong’s home in the middle of the night and stabbed her repeatedly. He then drove to his parents’ home a few miles away, and, at their urging, called 911.

Frick’s mother, Cynthia, declined to comment after Friday’s hearing.