Former US teen star Leif Garrett has agreed join a strict drug-diversion programme for violating his probation in a cocaine case.
Garrett had a string of hit records and appeared in 36 movies
Garrett, 44, was commended by the judge at LA Superior Court for his decision and his release from jail was ordered.
On Wednesday he pleaded not guilty to possession of heroin stemming from an arrest on 14 December.
His first film was 1969's Bob & Carol & Ted & Alice and his hits include I Was Made for Dancing and Surfin' USA.
The performer pleaded guilty in March to attempted possession of cocaine-based narcotics stemming from a 2004 arrest, and was placed in drug treatment.
After he failed to appear in court last month for a status report a warrant was issued for his arrest.
He had previously had been ordered into drug treatment, which he failed, but the spokeswoman said his new programme would be "much more intense".
"It's frequent testing and daily counselling" and lasts a minimum of a year, she said.
Garrett has appeared in 36 films, mostly in the 1970s and 1980s, and has released 10 albums.