(CNN) Pennsylvania Attorney General Josh Shapiro said Wednesday he plans to appeal a district court judge's decision to throw out the conviction of former Penn State President Graham Spanier as part of the Jerry Sandusky case.

Spanier had been convicted on one count of endangerment of the welfare of a child relating to the Sandusky sex abuse case, and he was set to begin serving a two-month prison sentence on Wednesday, according to CNN affiliate WNEP

But on Tuesday, Judge Karoline Mehalchick vacated his conviction, according to court records, because it was based on a criminal statute that did not go into effect until after his conduct was alleged to have taken place.

The child endangerment statute was from 2007, while his conduct took place in 2001, according to court documents.

Shapiro said the federal judge's last-minute decision was "highly unusual" and exceeded the court's power.

Read More