Updated

Lindsay Lohan had agreed to get some help.

The 26-year-old troubled starlet took to a plea deal in a Los Angeles court on Monday, agreeing to stay in a “locked rehab facility” for 90 days.

The actress pleaded no contest to reckless driving, lying to police and obstructing officers who were investigating the accident involving the actress in June.

A judge says Lohan will also be sentenced 30 days of community labor and 18 months of psychological therapy.

A somber Lohan sat in court next to her attorney, Mark Jay Heller, who the judge praised, calling the New York lawyer “more than qualified” to handle LiLo’s complicated case.

“She is to do 90 days at a locked rehab facility,” the judge explained. “She is not allowed to leave the facility at all.”

The judge also had some more personal words for Lohan, advising that the actress avoid getting behind the wheel in the near future.

“Don’t drive,” he said, noting that his advice was not a formal part of her plea deal. “You’re in New York. You don’t need to drive.”

He also stressed the gravity of the situation to the “Liz & Dick” star, who has seemingly lucked out time after time in the courtroom.

“You really need to understand…. This is it... Please take this seriously.”

Earlier in the day, it seemed Lohan was anything but serious about her case, as she arrived more than 45 minutes late to her scheduled hearing.

Lohan reportedly missed her original Sunday night flight from New York to Los Angeles, instead traveling on a private plane provided by a Los Angeles-based energy drink company for which she has made promotional appearances.

"Thanks Mr. Pink for the private jet see you all in a few hours in LA," she tweeted early Monday. 

Still, things worked out in Lohan’s favor. The actress was facing 245 days in jail for alleged lying to police before she accepted the plea deal. 

Since a pair of arrests for driving under the influence in 2007, Lohan has resolved her numerous court problems without ever going to trial. Instead she has faced numerous judges who have sentenced her to jail, rehab and counseling, which even her current attorney acknowledges have not completely helped the troubled actress.

The former Disney star has been under some form of probation since she was arrested twice in 2007 for driving under the influence, and her court troubles have stifled a once-promising career.

Lohan's return to acting last year in the Lifetime movie "Liz & Dick" was widely panned by critics and viewers. Her upcoming film by Bret Easton Ellis, "The Canyons," co-starring porn star James Deen, is yet to be released.

The Associated Press contributed to this report.

More On This...