Lindsay Lohan is waiting to enter rehab after escaping a jail sentence over a car crash case.
The 26-year-old has accepted a plea deal that includes 90 days in a locked-down rehabilitation facility that she will not be able to leave.
Her lawyer Mark Heller said afterwards: "I am very satisfied with the results in court today. I am very confident that Lindsay will be able to move forward in her life with dignity, with pride, and with respect..."
He was heckled by Lindsay's father Michael, who attacked the attorney, saying: "This man has lied to her - he told her everything will be fine. She had no idea what was happening behind closed doors with the court or any of the negotiations. He is going to be investigated now. I am going to pursue this so this guy does not practice law any more."
Lohan has struggled for years with legal problems and has been briefly jailed five times.
In her latest case she pleaded no contest to reckless driving and lying to police who were investigating the accident involving the actress in June along the Pacific Coast Highway. A charge of obstructing an officer was dropped. Lohan also was found in violation of her probation in a 2011 necklace theft and sentenced to 180 days in jail.
However, she can avoid jail time if she complies with the conditions of her plea deal, which also includes 30 days of community labour, 18 months of psychological therapy and an unspecified fine.
Lohan said little to Superior Court Judge James Dabney in court and said "yes" when asked if she accepted the plea deal.
The judge did not set a date for the Mean Girls actress to begin rehab. Instead he set another hearing for May 2, when the court must be given proof of enrolment in a treatment programme.
The sentence extends Lohan's probation for another two years, and the judge warned her that there will not be any discussion about putting her back on probation if she does not meet the conditions of the latest sentence.