Cocaine dealer Alexander Minaides has walked free from court after a judge heard how he had turned his life around.

The 21-year-old from Corsham was caught with hundreds of pounds worth of the class A drug in Chippenham in January and electronic scales, glucose powder to mix with it and self seal bags were later foud at his Kings Avenue home.

After hearing how Minaides, who has a history of drugs offences, had completely changed his ways a judge at Swindon Crown Court decided not to pass a jail term.

But Recorder Timothy Mousley did warn him that should he fail on the order he could expect a four-year sentence.

Chris Smyth, prosecuting, told the court Minaides was caught with 13.7 grams of the drug when officers were carrying out an observation on an area off Langley Park.

They saw three men approaching a bin and while two of them stopped short Minaides went up and leaned behind to retrieve a package, which he put in his pocket.

As an officer moved in Minaides ran off and during the chase threw the bag in a garden before being arrested after running into a nearby pub.

The detective retraced his steps and found the bag, which was found to contain a white powder that later tested as cocaine and Minaides had £1,685 in his pocket.

Mr Smyth said police went to his home where they found two sets of scales, glucose powder which is used for mixing with the drugs and more bags.

He said the drugs found on the defendant would have a street value of between £375 and £600.

When he was questioned Minaides denied any wrongdoing, saying he saw something by the bin and went to pick it up to see what it was and ran off because he thought the police wanted him on a warrant.

Minaides had originally pleaded not guilty to possessing drugs with intent to supply but before a jury could be sworn in on the morning of his trial he changed his plea to guilty.

The court was told that he had a history of offending including a number of other drugs matters.

Paul Grumbar, defending, said in the year since the offence Minaides had undergone a miraculous' change in his lifestyle.

He said he has been reconciled with his family, settled down with a new girlfriend, got a job and stopped taking drugs.

Having started taking drugs as a 14-year-old he said Minaides had become hopelessly addicted and even on drug treatment orders continued to use.

He said that he was only selling cocaine to fund his own habit but he has now moved away from his old haunts and old friends to sever the link with drugs, Mr Grumbar said.

If he were jailed he said Minaides associating with other users in prison could set back his rehabilitation and return him to addiction.

Passing sentence the judge said that the matters were "so serious that only a custodial sentence can be justified".

And he said were he to suspend the sentence it could not be for more than 51 weeks, which was insufficient.

However he said bearing in mind Minaides' progress and vulnerability should he be jailed he would pass a community order.

He told him to complete 200 hours of community service and a one year probation order and if he failed on it he could be jailed.

He said: "I would have in mind, bearing in mind your guilty plea and when it was entered, it would be four years' imprisonment."

In January 2005 Minaides escaped a jail term after being caught with more than £1,000 worth of ecstasy tablets in his bedroom.

Although he was charged by the police with possession with intent to supply the Crown Prosecution Service reduced the allegation to simple possession.

As well as 109 ecstasy tablets, police also found 0.427 grams of amphetamines, 249 grams of cannabis resin, 19 diazepam tablets and some herbal cannabis with a total street value of between £1,400 and £1,500.

He was sentenced to a drug treatment and testing order after telling the court how he was taking 15 ecstasy tablets a day along with other drugs.