A Wisconsin teenager who admitted to taking part in the stabbing of a classmate to please horror character Slender Man will avoid prison time after a jury determined Friday that she was mentally ill at the time of the incident.

Anissa Weier, 15, pleaded guilty to attempted second-degree intentional homicide in a deal with prosecutors but claimed she was mentally ill at the time of the attack and was not responsible for her actions. A plea agreement called for her to spend at least three years in a mental hospital if judged mentally ill, and 10 years in prison if not.

Weier and Morgan Geyer lured classmate Payton Leutner into the woods at a park in Waukesha, a Milwaukee suburb in 2014. Geyser stabbed Leutner 19 times while Weier urged her on, investigators said. A passing bicyclist found Leutner, who was barely alive, in the woods. All three girls were 12-years-old at the time.

WISCONSIN CHOCOLATIER, MARS CANDY COMPANY RESOLVE DISPUTE

Both Weier and Geyer told detectives they felt they had to kill Leutner to become Slender Man’s “proxies,” or servants, and protect their families from the supernatural monster. The character originated from an internet “creepypasta.” A creepypasta are horror stories written and circulated on the internet.

Slender Man, a monster depicted as a long-limbed, lean man in a black suit, with no face, is one of the more well-known creepy pasta personalities, Time reported.

Maura McMahon, Weier’s lawyer, said she hoped the case revealed that children may be handling mental issues lost on adults who have become too busy with their own lives to pay attention and resources abound to help them.

"Life is better for children when adults around them are in communication with each other," she said.

Deputy District Attorney Ted Szczupakiewicz declined comment. Leutner's family left the courtroom in silence; a victim witness coordinator told reporters the family had no comment.

Judge Michael Bohren ordered a pre-commitment investigation report on Weier and said he would hold a hearing to decide how long to commit her after the report is completed. He could sentence her more severely than the plea agreement calls for, including up to a 25-year commitment, the same as the maximum prison time she could have received.

Though that first verdict wasn't read in court, defense attorney McMahon said 10 of 12 jurors — the minimum required by law — voted Weier was mentally ill. On a second question that jurors had to decide — whether she was criminally responsible for her actions — 10 jurors also voted she was not.

McMahon claimed Weier was lonely and depressed stemming from her parent’s divorce, and she latched onto Geyser. The two girls became obsessed with Slender Man and Weier believed the monster could read her mind and would kill her family or her if she talked about him, McMahon claimed.

CHRISTIAN DAIRY QUEEN OWNER HANGS ‘POLITCALLY INCORRECT’ SIGN IN RESTAURANT, SPARKS CONTROVERSY

However, Szczupakiewicz argued that the girls planned the attack for at least four months. He asked jurors to consider why if the girls were so afraid of Slender Man they waited so long to attack Leutener. He also pointed out that Weier told detectives she was not afraid of the character until after the attack.

"It comes down to did she have to or did she want to?" Szczupakiewicz said. "It wasn't kill or be killed. It was a choice and she needs to be held criminally responsible."

Weier, bespectacled and dressed in a long gray-and-white cardigan, visibly trembled in her seat during her closing. She was not available afterward, but McMahon said she was relieved and cried following the verdict.

Geyser has pleaded not guilty to one count of attempted first-degree intentional homicide by reason of mental disease or defect. Her trial is set to begin Oct. 9.

The Associated Press contributed to this report.