(ABC NEWS) -- Lindsay Lohan has avoided jail and averted a trial in her alleged lying-to-cops case by agreeing to 90 days in rehab and 30 days of community labor in a deal struck today between her attorney and Los Angeles prosecutors.
The "Mean Girls" actress also agreed to pay an undisclosed fine and attend 18 months of psychological therapy. Judge James Dabney characterized the three-month stint in rehab as "locked," meaning the actress can't go home once she enters the program. If she completes all the terms of the deal, a 180-day jail sentence will be waived.
The deal was struck just as Lohan's trial - on charges that she lied to police about whether she was behind the wheel in a June car crash that briefly sent her to the hospital - was set to begin this morning. The 26-year-old actress had pleaded not guilty to three misdemeanor charges filed after the accident: reckless driving, lying to police and obstructing officers from performing their duties.
As a result of the charges stemming from the accident, her probation in a 2011 theft case was revoked in December. The Liz & Dick" star still faces up to 245 days in jail for violating her probation.
Lohan arrived more than 40 minutes late for today's trial, which had been scheduled to start at 8:30 a.m. PT.
The actress raced from New York this morning, tweeting around 7 a.m. ET time that she was flying by private jet to Los Angeles.
"Thanks Mr. Pink for the private jet see you all in a few hours in LA @drinkmrpink @sheerazhasan," she wrote. Mr. Pink is an energy drink.
Her plane had been scheduled to land at the Van Nuys airport but was instead diverted to Los Angeles International Airport, which is closer to the courtroom.
Shortly after the trial had been expected to start, the judge came to the bench and said, "I understand we're waiting for the defendant" before leaving the courtroom, filled with attorneys, media and spectators, including Lindsay Lohan's father, Michael Lohan.
When Lohan finally arrived, wearing a sheer white outfit, she was showered with what appeared to be yellow dust or glitter while making her way through a throng of photographers and onlookers into the courthouse.
RELATED: Lohan's Courtroom Drama and Comeback Attempts
Soon after she arrived in court, her attorney, Mark Heller, whispered to prosecutors that he'd like to chat in another room. They were accompanied by the court reporter, while Lohan remained seated in court.
They stayed behind closed doors in the judge's chambers for nearly two and a half hours before court was called back into session and the plea deal was announced.
Lorena Blas, USA TODAY