18-year-old William Marks enters District Court for his arraignemnt in Milford, N.H., Tuesday, Oct. 6,2009. (AP Photo/Jim Cole)

Eighteen-year-old William Marks enters District Court for his arraignemnt in Milford, N.H., Tuesday, Oct. 6,2009. (AP Photo/Jim Cole)

A judge rejected a plea agreement Monday under which a teenager would have avoided a potential life sentence for a deadly New Hampshire home invasion that ended in the death of a woman and injuries to her daughter.

William Marks of Amherst, 18, was to have pleaded guilty to conspiracy to commit murder and other charges. The state had agreed to drop a first-degree murder charge in exchange for a sentence ranging from 30 to 60 years and Marks’ agreement to testify against others accused in the case.

READ MORE: Zachary Richardson Identified As Man Killed By Officers After 'Repeatedly Ramming' Leicester Police Station

Judge Gillian Abramson said she wouldn’t accept the Marks deal because a sentence should be about punishment, rehabilitation, deterrence and segregating a criminal from the community.

“The proposed sentence does not satisfy any of these goals,” she said.

The Oct. 4 home invasion resulted in the stabbing death of Kimberly Cates. Her 11-year-old daughter, Jaimie Cates, was severely wounded.

Before Abraham rejected the plea deal, she asked prosecutor Jeff Strelzin how he arrived at it. Strelzin recalled the case of Dartmouth professors Half and Susanne Zantop, who were stabbed to death in 2001.

He said one of the two teens charged in that case, James Parker, had pleaded guilty to being an accomplice to second-degree murder and was sentenced to 25 years to life in prison.

The other defendant, Robert Tulloch, eventually pleaded guilty to first-degree murder and was sentenced to a mandatory life sentence without parole.

READ MORE: Pfizer COVID-19 Shot Expanded To US Children As Young As 12

“In some ways this case is more harsh,” Strelzin said of Cates’ death. “A little girl was injured, and this case was even more brutal.”

Peter Leahy, Marks’ lawyer, said Marks is sorry for his role.

“He does have nightmares,” Leahy said.

Jim Marks, Marks’ father, said his son “tried everything to get out of it; he just couldn’t.” When asked why he couldn’t, Marks said, “I just think he didn’t know how.”

Five men were charged in connection with the attack. Authorities said two of them, 18-year-old Steven Spader and 20-year-old Christopher Gribble, were the ones who wielded the machete and knife. Police said Gribble told investigators the two men had planned the attack “for fun.”

Both Gribble and Spader have pleaded not guilty to first-degree murder and other charges; Gribble’s attorneys say they may say Gribble was insane at the time.

MORE NEWS: Should I Be Worried About Maskless People If I’m High-Risk? Dr. Mallika Answers COVID-19 Questions

Two others, Autumn Savoy and Quinn Glover, have pleaded guilty to lesser charges and agreed to testify against Spader and Gribble.