A judge sentenced a 15-year-old Wisconsin girl to 40 years in a mental hospital on Thursday after she, along with another girl, admitted they tried to murder a classmate in order to please a fictional horror character named “Slender Man.”

Morgan Geyser, 15, pleaded guilty in October to attempted first-degree intentional homicide in accordance with a plea deal to avoid serving time in prison.

In 2014, Geyser and Anissa Weier, who was sentenced in December to 25 years in a mental health facility, lured their classmate Payton Leutner into a wooded park in Waukesha and stabbed her several times with a kitchen knife. All three girls were 12 at the time. The girls left Leutner for dead but she managed to crawl out of the woods and attract help from a passing bicyclist, investigators said.

Both Weier and Geyser said they felt they had to kill Leutner to become Slender Man's "proxies," or servants, and protect their families from him.

WISCONSIN TEEN IN ‘SLENDER MAN’ STABBING SENTENCED TO 25 YEARS IN MENTAL HEALTH FACILITY

Prosecutors argued that Geyser should get the maximum sentencing for her crime. They provided testimony from Dr. Brooke Lundbohm who said the teen was hearing voices in her head as recently as September from someone named “Maggie.” Lundbohm added that she thought Geyser remained a danger to herself and the community.

"This is not a close call," Lundbohm said.

On the other side, the teen’s defense team, in consultation with two doctors, said Geyser’s condition had improved and she no longer was exhibiting psychotic symptoms. They said she should be admitted to a less restrictive facility with children her own age.

"I believe at the present time she is no more dangerous than any adolescent her age," Dr. Kenneth Robbins said.

SLENDER MAN STABBING VICTIM SLEPT WITH SCISSORS UNDER HER PILLOW, MOTHER SAYS

Geyser's attorneys have argued in court documents that she suffers from schizophrenia and psychotic spectrum disorder, making her prone to delusions and paranoid beliefs.

A psychiatrist hired by her attorneys previously testified that Geyser believed she could communicate telepathically with Slender Man and could see and hear other fictional characters, including unicorns and characters from the Harry Potter and Teenage Mutant Ninja Turtles series. She also claimed she had "Vulcan mind control."

Slender Man started with an online post in 2009, as a mysterious specter whose image people edit into everyday scenes of children at play. He is typically depicted as a spidery figure in a black suit with a featureless white face.

The Associated Press contributed to this report.