If he'd turned up in court
He should have gone to court to argue his case. The judge could have then turned around and said, if you'd come here five years ago I would have said what I'm about to say now. "Bail is cancelled. You are free to go. By the way your Visa has expired, so leave the country."