Green Bay Packers defensive lineman Johnny Jolly pleaded guilty to a drug possession charge Thursday and was sentenced to probation after striking a deal with prosecutors that wipes out a similar charge and spares him any time in prison unless he stumbles again.

Jolly had faced up to 20 years in prison if he had been convicted of possessing at least 200 grams of codeine, a controlled substance, after being arrested outside a Houston club three years ago. He pleaded guilty to the 2008 charge while a drug charge from March, in which he was also accused of possessing codeine, was dropped.

The plea agreement Jolly struck only stated the newer charge would be dropped in exchange for his guilty plea on the older charge and did not guarantee he would be given probation, said prosecutor Todd Keagle.

"I did not agree to give him probation. The judge used her experience and her best judgment in deciding what to do," Keagle said. "It's not uncommon in this courthouse for that to happen, where we don't offer probation and the judge gives someone probation."

Jolly entered his plea during a brief hearing, in which state District Judge Denise Bradley sentenced him to five years of deferred adjudication, a form of probation that will allow the conviction to be removed from his record if he stays out of trouble.

Bradley also ordered Jolly to undergo drug treatment at an inpatient facility for 90 days, barred him from going to bars or nightclubs and ordered him not to drink or use drugs while he is on probation.

The judge warned Jolly that if he violated any terms of his probation, "I will send you to prison."

Jolly, who has been jailed since his most recent drug arrest in March, said little during the court hearing. After the hearing, defense attorney Carl Moore said he was pleased with the sentence and plea deal.

"I think he's going to get the help he needs," said Moore, who added that Jolly would begin his drug treatment on Monday.

Jolly planned to undergo treatment at a facility in Houston run by former NBA player and coach John Lucas, who was at the court hearing with Jolly's mother.

"To save his life and get him back on track," Lucas said when asked how he planned to help Jolly. "I'm looking forward to helping him."

Lucas, who battled his own drug and alcohol abuse problems, has operated the Houston-based Wellness and Aftercare Program, a substance abuse recovery program for athletes, since 1986.

Jolly attended high school in Houston and played for Texas A&M. He was selected by the Packers in the sixth round of the 2006 draft. The 6-foot-3, 325-pound Jolly, who lives in a Houston suburb, started all 16 games for Green Bay in 2008 and '09.

Jolly's 2008 drug charge came after police said they found cups containing a codeine mixture in Jolly's car after he was arrested in the parking lot of a Houston club. He was suspended by the NFL without pay last season for violating the league's substance abuse policy, and his teammates won the Super Bowl without him.

In March, Jolly was arrested and charged again after a traffic stop. Police said they found a bottle containing 600 grams of codeine under a passenger seat and another bottle containing an unidentified substance.

Moore said Jolly is still hoping he can be reinstated by the NFL and resume his playing career.