Redmond O'Neal has pleaded no contest to felony possession of heroin and firearms charges.
The 26-year-old son of Ryan O'Neal and late actress Farrah Fawcett had been in jail since his arrest two weeks ago, but will now enter one-year inpatient rehab treatment after answering the charges after his attorneys Richard Pintal and Michael Brewer convinced Judge Keith Schwartz not to sentence him to prison.
Speaking afterwards, Mr. Pintal told RadarOnline.com: "Redmond is grateful for the opportunity to receive additional intensive treatment."
Redmond - who was jailed following his arrest because the offence marked a breach of probation set following a prior heroin possession conviction - was warned by the judge he will be given a prison sentence if he is arrested again, and was also put on probation for five years.
'Love Story' actor Ryan was in court in Los Angeles this morning (24.08.11) to see Redmond appear before the judge, along with Farrah's best friend Alana Stewart.
Redmond's half-sister Tatum O'Neal was unable to make the hearing but friends recently said she is determined to help her brother quit drugs.
A source close to the actress - who has overcome drug addiction herself - said recently: "Tatum will move heaven and earth to do whatever she can to help Redmond get and stay sober. Tatum loves Redmond tremendously, and doesn't want to lose her brother to this disease. Tatum is sincere and her concern for her youngest brother is genuine."