A Wisconsin teenager who was inspired by mythical character Slender Man to attempt to murder a classmate has escaped a prison sentence after a jury found her to be mentally ill.

Anissa Weier and Morgan Geyser were both 12-years-old at the time of the 2014 attack on Payton Leutner, also 12.

The pair lured her to a forest in Waukesha, Wisconsin, where Geyser, goaded on by Weier, stabbed her 19 times and left her for dead. Leutner managed to crawl to the side of a road where a cyclist found her. She was taken to hospital where doctors said she was 'millimetres from death.'

The pair admitted to their roles in the attack but claimed they acted as 'proxies' of Slender Man a mythical character peprpetuate don the dark web. The tall, pale skinned, faceless man in a black suit appears in the back of sepia-tinted photographs as an omen of some event to come.

"I believed that if I didn't go through with it, Slender Man would come and attack and kill myself, my friends and my family. Those I cared about the most," Weier told the court, ABC News reported.

Morgan Geyser and Anissa Weier
Morgan Geyser and Anissa Weier were charged with attempted murder over the attack in May 2014 Police handout

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.

Anissa Weier's lawyer Maura McMahon told the court that the teenager was lonely and depressed at the time of the attack and 'descended into madness'.

The pair bonded over their obsession with Slender Man with Weier believing the mythical character could read her mind and would kill her or her family if she talked about him.

"This sounds crazy, because it is," McMahon said. "This was a real being to this child and she needed to protect those around her."

Fictional web ghoulie Slender Man reportedly inspired schoolgirl's murder
Fictional character Slender Man reportedly inspired schoolgirl's murder

"At 12-years-old, she had no way to protect herself from (Slender Man) except for Morgan's advice and they swirled down into madness together."

McMahon urged the jury to send her to a mental hospital rather than convict her as a criminal which would have seen her serve over 10 years in prison.

A jury heard three days of testimony from psychologists and detectives. Melissa Westendorf who was appointed by a judge to evaluate Weier after her insanity plea, testified that she believed Weier suffered from a shared delusional disorder that left her unable to conform her conduct to the law when she and Geyser tried to kill their friend Leutner in 2014.

After deliberating for the day on Friday the jury determined that Weier was mentally ill at the time of the attack.

She will now receive treatment in hospital for three years rather than serve a prison sentence.

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 October 9, Mail Online reports.