FARGO, N.D. (AP) — A judge overstepped by giving a life prison sentence to a man whose girlfriend cut the baby from the womb of an unsuspecting neighbor, the North Dakota Supreme Court ruled Thursday, ordering that the man be resentenced.

William Hoehn, of Fargo, pleaded guilty to conspiracy to commit kidnapping in the August 2017 attack on Savanna Greywind, who died of her injuries but whose baby survived. He entered the plea before a jury acquitted him of conspiracy to commit murder.

Hoehn’s girlfriend, Brooke Crews, admitted that she sliced Greywind’s baby from her womb. She pleaded guilty and was sentenced to life in prison without the possibility of parole.

Hoehn had faced a maximum of 21 years behind bars for the kidnapping charge, but Judge Tom Olson granted prosecutors’ request to label Hoehn a dangerous offender, enhancing his maximum sentence to life with the possibility of parole.

The state Supreme Court, though, ruled that Hoehn shouldn’t have received that designation and ordered that he be resentenced.

Kiara Kraus-Parr, who argued the appeal for Hoehn, called it a “pretty clear-cut case” and said she had been “cautiously optimistic” that her client would prevail.

“I think the state overreached in what they charged, as far the special dangerous offender,” she told The Associated Press

Cass County State’s Attorney Birch Burdick said he hadn’t read the opinion yet but that his office would likely comment about it once it gone through it.

The justices said that for Hoehn to qualify as a dangerous offender, his 2012 conviction for abuse or neglect of a child would have to be similar to the conspiracy to commit kidnapping charge. A comparison of the elements of the crime did not support the finding that the two offenses were comparable, the court found.

A new sentencing date should be set in two weeks, depending on whether prosecutors file for a rehearing.

Greywind was a member of the Spirit Lake Sioux Tribe and her family has ties to the Turtle Mountain Band of Chippewa, two North Dakota groups that traveled to the Fargo area to search for Greywind after the attack. Her death prompted former North Dakota Sen. Heidi Heitkamp to introduce Savanna’s Act, which aims to improve tribal access to federal crime information databases and create standardized protocols for responding to cases of missing and murdered Native American women. Protesters gathered around North Dakota on Monday, the second anniversary of Greywind’s death, to urge Congress to pass the bill.

Hoehn denied knowing anything about Crews’ plan to kill Greywind and take her baby, but he admitted to hiding the newborn and giving false information to law enforcement to cover up the crime.

Crews testified during Hoehn’s trial that she concocted a phony pregnancy because she was afraid of losing him, and that when he figured out she was lying, he told her she needed to produce a baby. Crews said she took that as an ultimatum.

Crews said she never explicitly told Hoehn what she planned to do, but that when he arrived home to find a newborn and a bleeding Greywind, he twisted a rope around Greywind’s neck to make sure she was dead. A coroner was unable to determine if the cause of death was strangulation or blood loss.