Former football star Todd Marinovich pleaded guilty on Tuesday to misdemeanor public nudity, drug and trespassing charges stemming from his arrest in Irvine last year.

Appearing in the Harbor Justice Center in Newport Beach, the former USC and Raiders quarterback pleaded guilty to five misdemeanor counts and was sentenced to serve 90 days in jail.

However, the jail sentence will be stayed pending completion of six months in an outpatient rehab facility and three years of probation, said his attorney, Adam Cole.

So Marinovich can avoid jail.

Marinovich was arrested in August when he was found in a stranger’s backyard in Irvine after police were called concerning a naked man walking near Venta Spur Trail.

Authorities said Marinovich, who has long battled drug abuse, was nude and carrying a brown bag with methamphetamine, marijuana, syringes, a marijuana pipe and his wallet.

Cole said Marinovich decided to check into an out-patient rehab facility after his arrest and is doing well. He said Marinovich is subject to regular drug tests at the facility and has been testing clean since his arrest nearly seven months ago.

“He’s positive and in good spirits, and he wants to be held accountable for what he did,” Cole said. “He’s looking forward to his future.”