LOS ANGELES - Lindsay Lohan's days as a criminal defendant could be over -- if she can behave herself.
A judge on Thursday ended the long-running probation of the problem-prone actress in a 2007 drunken driving case after a string of violations, jail sentences and rehab stints.
The 25-year-old actress will remain on informal probation for taking a necklace without permission last year, but will no longer have a probation officer or face travel restrictions and weekly shifts cleaning up at the morgue.
Lohan, wearing a powder blue suit and black blouse, let out a sigh of relief as she left Judge Stephanie Sautner's courtroom, possibly for the last time.
"I just want to say thank you for being fair," Lohan told the judge. "It's really opened a lot of doors for me."
The judge said she wasn't going to lecture the actress, but gave her some parting advice.
"You need to live your life in a more mature way, stop the nightclubbing and focus on your work," Sautner said.
She reminded Lohan that she will remain on informal probation until May 2014 in the necklace case and could face up to 245 days in jail if she gets into trouble again.
Still, the end of probation left Lohan looking relieved. She hugged her attorney, Shawn Holley, before leaving the courtroom, and was beaming by the time she walked past the rows of cameras waiting for her outside the courthouse near Los Angeles International Airport.
Sautner's regimen of morgue duty, therapy and monthly court dates helped Lohan weather the drunken driving case. The judge opened the hearing by calling the case "endless."
Lohan is now free to focus on her career for the first time since May 2010, when she missed a court appearance and was later jailed for failing to complete the terms of her sentence.
The "Mean Girls" star has struggled with the case and her career since the two drunken driving arrests in 2007.
She had small appearances in films and did some modeling but came nowhere near her heyday as the star of Disney films and movies aimed at teens and young adults.
Her career is already showing signs of a comeback. She is due to guest star on an upcoming episode of "Glee," recently hosted a highly rated but criticized episode of "Saturday Night Live," and is set to star as Elizabeth Taylor in a television movie.
"Lindsay is already talking about her next few projects," her spokesman Steve Honig wrote in a statement after the hearing. "She is ready to start the next chapter in her life and get back to work and doing what she loves to do -- making movies."
Lohan's tortured four-and-a-half-year effort to complete probation is not unprecedented. Actress Michelle Rodriguez took more than five years to resolve her drunken driving case, which featured many of the same elements as the Lohan saga -- missed deadlines and jail sentences.
Other celebrities resolved their DUI cases much faster. Fellow female celebrities such as Paris Hilton, Nicole Richie and Khloe Kardashian were all sentenced to jail and faced multiple court hearings because they didn't properly comply with orders from a judge, but their cases have long since ended.
Lohan might still have to return to a courthouse to resolve civil issues.
Two weeks ago, a nightclub manager in Hollywood accused her of grazing him with her Porsche. The actress denied the accusation and no charges have been filed. But the matter could end up in a civil court, where Lohan is already being sued by two other people for auto-related incidents.
Three men who were in a car that Lohan commandeered and used during a chase along Pacific Coast Highway are suing her and the case is scheduled for trial later this year. The incident led to her second drunken driving arrest in 2007.
Lohan is also being sued by a woman who claims she was struck by the star's car while walking in West Hollywood, and by a former Betty Ford worker who was involved in an altercation with the actress during her three-month stay at the facility in late 2010.