Courtney Love (search) was sentenced Tuesday to 18 months in drug rehab, closing one chapter in a troubled saga that began when she was accused of trying to break into her ex-boyfriend's home while high on cocaine.

Superior Court Judge Patricia M. Schnegg (search) gave the rocker until Oct. 29 to enroll in a drug counseling program, which will require frequent drug testing. She will be permitted to travel, but will be barred from taking non-prescription drugs, drinking alcohol or being in places that serve alcohol.

"I have to stop drinking. That's funny," Love said outside court, firing up a cigarette. "I think I can do it."

The 40-year-old widow of Nirvana singer Kurt Cobain (search) showed up to her sentencing 15 minutes late, dressed in a two-piece lavender suit and purple high heels. She sat down and immediately began reading the British music magazine NME.

Love appeared demure during the hearing, despite a history of being admonished by judges for courtroom outbursts. Several times she put her hands over her face and shook her head.

"Thank you," she told the judge when it was over.

Love was arrested in October after she allegedly tried to break into the home of former manager and boyfriend Jim Barber (search). Authorities said cocaine and other opiates were found in her system.

A series of charges followed: possessing illegal painkillers, assault, reckless endangerment, attacking someone with a liquor bottle. Then there were escapades like strange courtroom statements, allowing herself to be photographed with her nipple in a stranger's mouth and flashing her breasts on David Letterman's TV show.

Assistant City Attorney Jerry Baik said Tuesday's sentence was negotiated under a plea agreement with Love's attorneys. She pleaded guilty May 25 to a misdemeanor count of being under the influence of a controlled substance and agreed to enter a treatment program.

An additional charge of being a disorderly drunk in public was dismissed Tuesday at the prosecutor's request.

Love still faces a felony case in Beverly Hills Superior Court for allegedly possessing illegal painkillers. She could face up to three years and eight months in prison if convicted of possessing hydrocodone and oxycodone.

Last month, Love was arraigned in New York City on charges of assault and reckless endangerment for allegedly striking a fan with a microphone stand at an East Village club in March. She was scolded by the judge for showing up more than five hours late.

The most recent case involves an April 25 incident in which she allegedly attacked a 32-year-old woman with a liquor bottle at Barber's Los Angeles home. A bench warrant for her arrest was issued earlier this month after she failed to appear for an arraignment.

At the time, her attorney, Michael Rosenstein, said she had been hospitalized in New York City for an unspecified gynecological condition.

Love is the former lead singer of the band Hole. She and her new band, The Chelsea, were scheduled to start a tour last month to support Love's recent album "America's Sweetheart."

But Love delayed the tour amid her legal troubles. Whether Tuesday's sentence will even allow her to perform in typical rock venues, where liquor flows like water, was unclear.