Scotland international Garry O'Connor has been spared a prison sentence after being found guilty of possession of cocaine and obstructing police.
O'Connor was instead sentenced to 200 hours' unpaid work by Sheriff Derrick McIntyre at Edinburgh Sheriff Court.
The 29-year-old was found guilty after being found with cocaine on June 1 and then trying to run away from police officers when they were taking his details.
"Charge two involves a significant amount of Class A drugs and I would be fully justified in sending you to prison," said Sheriff McIntyre.
"I would have thought that someone in your position, as a footballer in the public eye, would set a better example to young people including your own son, which you now seem to acknowledge."
O'Connor spent four years with Birmingham City between 2007 and 2011 and has won 16 caps for the national side, scoring four goals.