Andrew Magill, 27, pleaded guilty in district court Wednesday to second-degree murder in connection with the 2017 death of a Coe Ranch caretaker in Glencoe east of Ruidoso.

District Attorney John P. Sugg said Magill also pleaded guilty to two counts of assault with intent to commit a violent felony upon a peace officer, and one count of possession of a firearm by a felon during a hearing before District Judge Daniel A. Bryant.

Magill used an ax to kill Mary Ann Moorehouse during what a state contracted psychiatrist called a "drug-induced psychosis."

"Part of the reason we've decided to enter into this plea agreement, reluctantly, is because of the findings by Dr. Michael Welner," Sugg said at a press conference after the plea change hearing May 22.

MORE:Andrew Magill found competent to stand trial for murder of Glencoe women

Welner, a psychiatrist, was paid $100,000 for his work, an amount that Sugg said was justified given the nature of the case.

Welner reported that Magill believed himself to be Jesus Christ and that he had to kill Moorehouse to save the world, Sugg said.

Since Magill has been on medication, he has not had any further issues, Sugg said.

Magill faces up to 51 years in prison at a sentencing hearing scheduled for September.

In a prepared release, Sugg provided a detailed account of the events leading up to the death of a caretaker at the Coe Ranch in Glencoe.

Hallucinations reported

Sugg said on March 30, 2017, Magill was staying in the Drury Hotel in Albuquerque with his wife and toddler daughter when he began having hallucinations that he was being attacked by the devil and that he was Jesus Christ.

Magill had an altercation with a front desk employee at the hotel after losing his room key, and he threatened the employee before causing thousands of dollars of damage to the hotel, Sugg said.

MORE:District Attorney: 2 homicides scheduled for trial

Magill then drove his family toward Roswell when he became convinced his luggage was cursed, Sugg said. He stopped on the side of the road and threw his family’s belongings out.

In Roswell, Magill's hallucinations continued, Suggs said, and he began threatening his wife and daughter, the district attorney said.

Magill left Roswell and traveled to Ruidoso, Sugg said. Magill had family in the area, including his uncle, Joe Magill, a former FBI agent and former chief of police in the village of Ruidoso.

Attack occurs at Coe Ranch

While traveling west on U.S. 70, Magill pulled his truck to the side of the road in

Glencoe. He abandoned his truck and entered the historic Coe Ranch on foot.

Moorehouse, a caretaker on the property, saw an unknown person on the ranch and went to investigate, the district attorney said.

According to statements made by Magill, Moorehouse attempted to find Magill a ride

home and asked Magill for a relative’s phone number so she could call someone to come help him, Sugg said.

When Moorehouse began calling one of the phone numbers Magill provided, he knocked her to the ground and retrieved an ax from a nearby work truck. Magill then struck Moorehouse at least four times with the ax, nearly decapitating her, Sugg said.

Magill then “baptized” himself in a nearby creek and hitchhiked to the Ruidoso Downs Police Department, where he told officers he had just killed a man and chopped a woman’s head off with an ax so that he could save the world, Sugg said.

MORE:Magill indicted in Moorhouse murder

The RDPD officers, not knowing Moorehouse had been murdered, had Magill transported to the Lincoln County Medical Center for a mental health evaluation, the district attorney said.

At the same time Magill was at the detention center, the Lincoln County Sheriff’s Office received a call from the ranch’s foreman, who stated he was concerned for Moorehouse's well-being because he could not reach her.

The foreman had been on the phone with Moorehouse when she saw an unknown person on the ranch. She hung up when she said she was going to investigate, and she would not answer his repeated

phone calls back to her.

Shooting at the Lincoln County hospital

Lincoln County Sheriff’s deputies responded to the ranch and found Moorehouse's body, Sugg said. A homicide investigation ensued, and eventually, the RDPD responded to the scene to assist deputies in clearing the property. RDPD officers then relayed information about their contact with Magill to the District Attorney’s Office. Deputies and an investigator with the DA's Office responded to the hospital to secure the defendant.

One of the deputies who responded to LCMC was Jason Green. When Green was talking with other law enforcement officers near Magill’s room, Magill got out of his bed and attacked officers, Sugg said.

Green put Magill in a headlock and the two fell to the floor. Magill was able to grab Green’s firearm and yank it free from the holster. Magill then shot Green in the bicep and continued pulling the trigger, Sugg said. The gun did not fire again, jamming after the first shot.

MORE:Magill indicted in Lincoln County deputy shooting

Officers eventually were able to gain control of the weapon and Magill.

Green is on medical retirement following the shooting.

Magill initially pleaded not guilty by reason of insanity after Dr. Noah Kaufman, Ph.D. found that he was insane at the time these incidents occurred, Sugg said. Drug testing revealed that Magill only had marijuana in his system. No other drugs were detected, the district attorney said.

The prosecution hired Dr. Michael Welner, M.D., a world-renowned psychiatrist to evaluate Magill. Welner evaluated Magill and found that he was sane at the time, but that he was under a drug-induced psychosis at the time he committed the crimes. Dr. Welner believes the psychosis began when Magill was in Albuquerque and was seen associating with an unknown woman, Sugg said.

MORE:No bail motion granted on ax murder suspect

The case was prosecuted by Sugg and was investigated by the Lincoln County

Sheriff’s Office, the New Mexico State Police and the Ruidoso Downs Police Department.

Reporter Dianne Stallings can be contacted at dstallings@ruidosonews.com.

Nicole Maxwell can be contacted by email at nmaxwell@alamogordonews.com, by phone at 575-415-6605 or on twitter at @nicmaxreporter.