Redmond O'Neal is getting one last chance to clean up his act.
After pleading no contest today to felony possession of a firearm by a felon and heroin charges, the 26-year-old son of actor Ryan O'Neal and the late Farrah Fawcett was ordered to spend one year in an in-patient rehab center and given five years of formal probation, E! News has learned.
It could've been a lot worse.
As a prior drug offender, O'Neal could've gotten up to three years in state prison, but Judge Keith Schwartz agreed to suspend that sentence as long as he stayed out of trouble and avoided arrest.
Redmond was busted Aug. 2 on drug possession charges after a routine traffic stop in Los Angeles. Given that he's currently probation for prior drug offense, a subsequent search of his apartment turned up a gun, leading the D.A. to tag on the weapons charge because it's illegal for a convicted felon to possess one.
Jane Robison, spokeswoman for the Los Angeles District Attorney's Office, tells E! that prosecutors didn't put an offer on the table but O'Neal caught a break after showing a willingness to take responsibility for his actions.
"We didn't offer any plea or negotiation. He just threw himself on the mercy of the court," Robison says.
Ryan O'Neal attended the hearing along with Fawcett's best friend, Alana Stewart, to express their silent solidarity.
While granting the reprieve, Schwartz did issue a stern warning saying Redmond would find himself in the Big House if he violated any of the conditions.
Following the proceeding, O'Neal's attorneys, Richard Pintal and Michael Brewer, issued a joint statement thanking Schwartz for recognizing Redmond's problems with substance abuse and his desire to overcome them.
"Today Judge Scwhartz ordered Redmond to undergo the best chance that he has had for a lasting recovery," read the statement. "The defense team is pleased and grateful that justice was served today."
Brewer did not disclose the drug treatment facility O'Neal will enter, but one thing's for sure: It won't be a place where the Malibu kid will be coddled.
Said the legal eagle: "It's geared toward dealing with all the issues, from psychological to drug addiction and getting your life back on track."
Here's hoping Redmond does the same for his.