Robert Downey Jr. appeared in a Los Angeles courtroom on Friday to support his oldest son Indio Downey as he pleaded guilty to recent drug charges.

TMZ reported that the "Iron Man's" son - who was arrested in June and charged with one felony count of possession of a controlled substance and a misdemeanor count of possession of a smoking device - pleaded guilty and was ordered to complete the treatment program he entered into after his arrest.

Indio, who is considered a first-time offender, has been spending time in a rehab facility since his arrest on June 29 - in which cops reportedly found him in possession of cocaine and drug paraphernalia during a traffic stop in the West Hollywood area.

The Associated Press reported that Indio has already spent 70 days in rehab and has 20 days left to complete. The young musician's arraignment was originally scheduled for Aug. 29, but it was delayed due to his time in treatment.

Judge Keith Schwartz told Indio that he must complete the program and remain sober for 18 months before his record can be wiped clean. The judge also warned him to be careful about friends.

"I appreciate this opportunity, and I intend to make the most of it," Indio told the judge, according to the Associated Press.

Indio's Oscar-nominated father, who did not speak during the hearing, sat directly behind Indio and his attorney Blair Berk. Judge Schwartz acknowledged the actor's presence and used him as a source of inspiration to his son, saying, "I know in life people always look up to superheroes, but I think you might have contact or an inside as to one superhero - that's Iron Man."

In an interview with Vanity Fair Magazine, "The Judge" opened up about his own public struggle with drug addiction before finally getting sober in 2001. The actor's drug addiction sent him to rehab several time before his was sent to prison.

"He's his mother's son and my son, and he's come up the chasm much quicker than we did," the actor said. "But that's typical in the Information Age; things get accelerated. You're confronted with histories and predispositions and influences and feelings and unspoken traumas or needs that weren't met, and all of a sudden you're three miles into the woods."

He added: "Can you help someone get out of those woods? Yes, you can. By not getting lost looking for them. Pick a dysfunction, and it's a family problem."