Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WAUKESHA, Wis. — Prosecutors asked a judge Thursday to sentence a girl to 40 years in a mental hospital for stabbing a classmate in an attack she said was done to please the fictional horror character Slender Man.

Morgan Geyser, now 15, broke down in sobs during her plea hearing as a judge asked her to recount the 2014 stabbing of a classmate in a Milwaukee-area park. A co-defendant, Anissa Weier, also admitted a role in the attack.

"Anissa said that she couldn't do it and then I had to," Geyser said, her voice choking. When Judge Michael Bohren asked her where the girl was stabbed, Geyser said: "Everywhere."

Related: Jury Finds Girl in Slender Man Stabbing Was Mentally Ill

The victim, Payton Leutner, survived the attack by crawling out of woods, where she was found by a passing bicyclist. All three girls were 12 at the time.

Geyser will undergo a doctor's evaluation by Nov. 13, and a hearing for sentencing was to be scheduled later. The defense made no request for length of sentence.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Morgan Geyser enters a Waukesha County Court for a status hearing on Sept. 29, 2017, in Waukesha, Wisconsin. Michael Sears / Milwaukee Journal-Sentinel via AP, Pool

She agreed last week to plead guilty to attempted first-degree intentional homicide to avoid prison, continuing treatment in a mental hospital instead.

A jury last month determined Weier was mentally ill at the time of the attack. She faces at least three ydears in a mental hospital when she is sentenced later.

Prosecutors say Weier and Geyser lured their classmate, Payton Leutner, into the woods at a park in the Milwaukee suburb of Waukesha and then attacked her. Geyser stabbed Leutner 19 times while Weier urged her on, according to investigators.

Leutner's family issued a statement saying they were happy to avoid a trial.

"Though we do not believe that an institution is where these attempted murderers belong, the current legal system does not favor victims in this situation," the statement said.

It added: "With this closure, our daughter is a heroic survivor -- and no longer a victim."

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

Prosecutors initially charged both girls with attempted first-degree intentional homicide, which carries a possible sentence of up to 65 years in prison, but their plea deals spared them that. After Weier pleaded guilty to a reduced charge, a jury determined during her sentencing phase that she was mentally ill at the time of the attack and should not serve prison time.

Two weeks after the jury reached that conclusion, prosecutors and Geyser's defense attorneys agreed on a plea deal, avoiding a trial that was scheduled to start Oct. 16. Unlike Weier, Geyser pleaded guilty to the original charge.

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 testified that she 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. He was regarded by his devotees as alternately a sinister force and an avenging angel.