WAUKESHA, Wis. (CBSNewYork/AP) — A judge sentenced a Wisconsin girl to the maximum 40 years in a mental hospital for stabbing a classmate in an attack aimed at pleasing a fictional horror character known as Slender Man.

Judge Michael Bohren says 15-year-old Morgan Geyser remains a risk to hurt herself or others.

Geyser and another girl lured a classmate to a suburban Milwaukee park in 2014 and carried out the attack, with Geyser doing the stabbing. All three girls were 12 at the time.

Bohren said in passing sentence Thursday that although the attack happened when the girls were young, “what we can’t forget is this was an attempted murder.”

Geyser spoke briefly before she was sentenced, breaking down in tears as she apologized to the girl she stabbed. That girl survived.

Geyser pleaded guilty to attempted first-degree intentional homicide in October in a deal with prosecutors to avoid prison.

Geyser and Anissa Weier lured Leutner into the woods in a park and repeatedly stabbed her with a kitchen knife. Geyser stabbed Leutner 19 times while Weier urged her on, according to investigators. Leutner was left for dead but she crawled out of the woods and got help from a passing bicyclist. She and her attackers were all 12 at the time.

Weier was sentenced to 25 years in a mental hospital in December. She had pleaded guilty in August to being a party to attempted second-degree intentional homicide, but she claimed she wasn’t responsible for her actions because she was mentally ill. In September, a jury agreed.

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 believed 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.

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)