DENVER - What was supposed to be a joyous homecoming for a Colorado man whose 98-year prison term was cut short turned to heartache when he was detained by immigration officials just as he was set to be released.

Rene Lima-Marin's wife had decorated her home with balloons Wednesday and was ready to pick him up from prison. Instead, he called her to tell her he was being held by Immigration and Customs Enforcement.

Lima-Marin was convicted in 2000 in the armed robbery of two video stores. He was mistakenly released in 2008, then held a steady job, got married and had a son.

Authorities realized the mistake in 2014 and returned him to prison.

A judge on Tuesday ordered Lima-Marin's release, saying it would be "draconian" to keep him in prison