A judge has overturned the conviction of a Missouri woman who was a psychiatric patient when she incriminated herself in a 1980 killing that her attorneys argue was actually committed by a now-discredited police officer.

Judge Ryan Horsman ruled late Friday that Sandra Hemme, who has spent 43 years behind bars, had established evidence of actual innocence and must be freed within 30 days unless prosecutors retry her. He said her trial counsel was ineffective and prosecutors failed to disclose evidence that would have helped her.

Her attorneys say this is the longest time a women has been been incarcerated for a wrongful conviction. They filed a motion seeking her immediate release.