CHESAPEAKE, Va. — Virginia’s top court has unanimously exonerated a man convicted of the 1977 rape of a 12-year-old girl.

The Richmond Times-Dispatch reports that the court issued a writ of actual innocence Thursday for 58-year-old Roy L. Watford III, based on DNA testing in 2016.

Watford says he had pleaded guilty to the charge as an 18-year-old who was offered a plea deal that would let him to avoid jail, on the advice of his grandfather. He has said the conviction kept him from getting good jobs all his life.

The writ was opposed by the Virginia Attorney General’s office, which did note that the case was challenging. The newspaper reports that Watford’s case appears to be the first exoneration granted that was opposed by the state.

Information from: Richmond Times-Dispatch,