(CNN) -- Paris Hilton entered guilty pleas on two misdemeanor counts in a Las Vegas court and was placed on probation for a year Monday morning under a plea deal to settle a cocaine possession charge.
Hilton admitted to the judge that cocaine found in a purse she was carrying after a traffic stop last month was hers and that she lied about it.
"I said that the purse wasn't mine to the officer, your honor," Hilton said.
A felony cocaine possession charge was dropped in exchange for Hilton's guilty pleas on misdemeanor charges of drug possession and obstruction of an officer.
The celebrity-socialite will have to stay out of legal trouble for the next year or face time in a Las Vegas jail, Judge Joe Bonaventure told her. Any arrest, other than a minor traffic citation, would trigger a probation violation ruling, he said.
"The Clark County Detention Center is not the Waldorf Astoria," Bonaventure said to Hilton.
The judge also ordered Hilton to complete an intensive substance abuse program.
"We've arranged for Ms. Hilton to be in an outpatient program," defense lawyer David Chesnoff told the judge.
Hilton also will have to pay a $2,000 fine and complete 200 hours of community service, the judge said. She will not have to report to a probation officer.
"You have to understand When you break the law here, there are consequences," the judge said.
Bonaventure said it is not unusual for such felonies to be reduced to misdemeanors for defendants with no criminal record.
"This is a typical negotiation," he said.
"I know that Ms. Hilton is contrite and accepts responsibility for her actions," Chesnoff said.
Hilton was arrested after a traffic stop on the Las Vegas strip on August 27. A motorcycle officer reported smelling the odor of marijuana coming from the Cadillac Escalade driven by her boyfriend, Cy Waits.
A small plastic bag of cocaine fell out of a purse she was holding and into the hand of a police lieutenant while Hilton was being questioned, according to the police report.
Hilton does have a criminal record, including a Los Angeles drunken driving arrest in 2006. She was arrested three times in the following months for driving on a suspended license.
She spent two days in jail in June 2007 before Los Angeles County Sheriff Lee Baca released her, saying she could complete her 45-day sentence at home. The next day, however, a judge ordered her to return to jail, where she remained 18 more days.