DOVER, Del. — Delaware’s Supreme Court has overturned the life sentence of a man who was convicted of raping a 14-year-old girl.

Eric Curry of Dover was arrested in November 2015 after the sister of his victim witnessed the crime.

Curry was given a life term earlier this year after prosecutors asked a judge to declare him a habitual offender because of previous convictions for aggravated menacing and second-degree robbery.

But Curry argued on appeal that the judge wrongly used a 2016 version of the habitual offender law to sentence him for offenses that occurred in 2015.

In a ruling last week, the Supreme Court agreed, saying the prosecution’s petition for habitual-offender status was flawed and should have been denied.

The case was remanded to Superior Court for Curry to be resentenced.