Paris Hilton has been fined £2,000 and given 200 hours community service after pleading guilty to cocaine possession.
A Las Vegas judge also gave the 29-year-old heiress a one-year suspended sentence and warned that any new arrests in the city would result in her going to jail.
Hilton could have been jailed for up to four years on the cocaine possession charge, but she reached a plea deal with prosecutors over her arrest on the Las Vegas strip on August 28.
Judge Joe Bonaventure told her: "The purpose of this is that you change your conduct. In a reference to one of the group of hotels founded by Hilton's great-grandfather Conrad Hilton, he added: "I assure you that Clark County Detention Center is not the Waldorf Astoria."
Hilton and her boyfriend, nightclub manager Cy Waits, were stopped by police just before midnight after officers said they smelled marijuana coming from their vehicle. Hilton was charged with possessing 0.8 grams of cocaine found in a purse.
The former reality TV star initially denied the purse belonged to her, resulting in an additional charge of obstructing police. At Monday's court appearance she admitted: "I was in possession as well as telling the officer the purse was not mine." Asked what drug she was carrying, Hilton answered, "Cocaine."
Hilton spent three weeks in jail in Los Angeles in 2007 for violating probation on a reckless driving charge. In July, she was briefly detained in South Africa on suspicion of marijuana possession but was released without charge.