Morgan Geyser, 15, appears for sentencing before Waukesha County Circuit Judge Michael Bohren, Thursday, Feb. 1, 2018 in Waukesha, Wis. Geyser is one of two girls who tried to kill a classmate with a knife to appease fictional horror character Slender Man. Prosecutors want Geyser to spend the maximum 40 years in a mental hospital for stabbing Payton Leutner in suburban Milwaukee in 2014. (Rick Wood/Milwaukee Journal-Sentinel via AP, Pool)
Morgan Geyser, 15, appears for sentencing before Waukesha County Circuit Judge Michael Bohren, Thursday, Feb. 1, 2018 in Waukesha, Wis. Geyser is one of two girls who tried to kill a classmate with a knife to appease fictional horror character Slender Man. Prosecutors want Geyser to spend the maximum 40 years in a mental hospital for stabbing Payton Leutner in suburban Milwaukee in 2014. (Rick Wood/Milwaukee Journal-Sentinel via AP, Pool) Credit: Rick Wood

Waukesha, Wis. — A Wisconsin girl who stabbed a classmate to curry favor with the fictional horror character Slender Man will be committed to a mental hospital for 40 years, a judge ordered on Thursday, explaining his decision as “an issue of community protection.”

Judge Michael Bohren granted the maximum penalty that prosecutors had sought and discounted Morgan Geyser’s youth — she was just 12 — at the time of the attack in 2014.

“What we can’t forget is this was an attempted murder,” Bohren said. Earlier, he heard from four doctors who talked about how Geyser is making progress with her mental illness, to various degrees. But Bohren called the teenager “a fragile person” whose long history suffering from delusions make her a risk to hurt herself and others.

Geyser, now 15, spoke briefly before she was sentenced, breaking down in tears as she apologized to the girl she stabbed, Payton Leutner.

“I just want to let Bella and her family know that I’m sorry,” she said, using a nickname for Leutner. “And I hope she’s doing well.”

Geyser and another girl, Anissa Weier, admitted that they lured Leutner into some woods near a suburban Milwaukee park.

Geyser stabbed Leutner 19 times while Weier urged her on, according to investigators.

They left Leutner for dead but she crawled out of the woods and got help from a passing bicyclist. All three girls were 12 at the time.

“Really, judge, it’s a miracle that Peyton is still with us, that she survived this,” prosecutor Ted Szczupakiewicz said.

Geyser and Weier said they carried out the attack to appease Slender Man, a fictional online horror character who they said they feared would otherwise harm them and their families. Slender Man is often typified by spidery limbs and a blank white face.

Weier was sentenced to 25 years in a mental hospital in December.

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