Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A Missouri man who was locked up after officials realized he never served a 13-year sentence is being released from prison by a judge who decided he turned his life around when he should have been doing time.

Cornealious "Mike" Anderson's family began crying when the court granted his request for release nine months after he began serving the sentence he was given in 2000.

Judge Terry Lynn Brown lauded Anderson's "exemplary" behavior during his 13 years of freedom before the arrest. "You've been a good father. You've been a good husband. You've been a good taxpaying citizen of the state of Missouri.

"That leads me to believe that you are a good man and a changed man."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Anderson walked out of the courtroom with his wife and 3-year-old daughter on one arm and his mom on the other. Before being driven away to a freedom celebration at an undisclosed spot, Anderson told reporters he was "very happy. My faith has always been in God. I'm just so thankful. Thank God for everything."

Anderson was convicted of the 1999 armed robbery of a Burger King manager making a bank deposit but was out on bail while he appealed.

His appeals were shot down, but because of what the state has labeled a clerical error, he never went to prison.

Instead, he became a married father of four, a businessman and a youth football coach — an upstanding life interrupted when state officials realize the mistake and put him behind bars.

Anderson noted he had made no effort to conceal his identity while he was free. Tens of thousands of people signed a petition on Change.org urging his release.

Missouri Attorney General Chris Koster said in a statement that the outcome was "appropriate."

"From the outset, I have proposed a solution that balances the seriousness of Mr. Anderson's crime with the mistake made by the criminal justice system and Mr. Anderson's lack of a criminal record over the past 13 years," he said.

"Today's outcome appears to appropriately balance the facts as we understand them."

— Michelle Hofland and Tracy Connor

The Associated Press contributed.