Judge says man who spent nearly 17 years behind bars, 'wrongfully imprisoned'