07/03/2007 AT 12:25 PM EDT
Troubled rocker Pete Doherty pleaded guilty to a drug charge Tuesday, and was warned by the judge that he must attend rehab or face time in jail.
The Babyshambles frontman also pleaded guilty to failing to appear on time without a reasonable excuse. In fact, he arrived so late to the West London magistrate's court that the judge had already issued an arrest warrant.
Once he did arrive to deal with his case, District Judge Davinder Lachhar warned Doherty, 28, that this was his final opportunity to avoid prison, the Associated Press reports.
Doherty, who has battled addiction for years, admitted to possessing quantities of crack cocaine, heroin, cannabis and ketamine as well as to two driving infractions on May 5.
The judge deferred the sentence to Aug. 7 on condition that Doherty – who said he was willing to follow the judge's orders – enter a detox program on July 16.
"If you go to this place to have detox and take advantage of it then we will see what sentence is appropriate when you next come, but if you do not I can tell you now that you will go into custody," Lachhar warned Doherty, who wept as the judge spoke to him, the Guardian
"It's rehab or jail," Doherty, wearing a dark suit, black shirt and trademark trilby hat, told reporters as he left the courtroom. "I was going to rehab anyway, to be honest with you, but this is a little push."
Doherty, who has announced his intention
to marry Kate Moss
this summer, has been undergoing court-ordered drug rehab due to previous convictions.