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

Anissa Weier and Morgan Geyser 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, according to investigators. A passing bicyclist found Leutner, who barely survived her wounds. All three girls were 12 at the time.

Both Weier and Geyser told detectives they felt they had to kill Leutner to become Slender Man’s "proxies," or servants, and protect their families from the demon’s wrath.

Weier, now 15, pleaded guilty to attempted second-degree intentional homicide in a deal with prosecutors in August. But she claims she was mentally ill during the attack and not responsible for her actions, in a bid to be sent to a mental institution rather than prison. A plea agreement before trial called for her to spend at least three years in a mental hospital if judged mentally ill, and 10 years in prison if not.

The jury’s verdict came after some 11 hours of deliberations, and about an hour after it had appeared to reach a verdict in Weier’s favor only to see it rejected by Judge Michael Bohren.