IE 11 is not supported. For an optimal experience visit our site on another browser.

An innocent man pleaded guilty to a drug charge to get out of jail. It's more common than you think.

The defendant told a judge that the white substance he was caught with was powdered milk, but he pleaded guilty anyway to get out of jail.

An Oklahoma man who pleaded guilty to trafficking cocaine last week had his conviction dismissed days later after lab results determined the white substance he was arrested for having was not drugs.

It was in fact powdered milk he had gotten from a food pantry, he told a judge.

Cody Gregg, 26, pleaded guilty to trafficking drugs on Oct. 8 and was sentenced to 15 years in prison, Oklahoma County court documents show.

Oklahoma City Police officers had tried to stop him for a "traffic violation" in August while he was riding a bike, but he fled, police Capt. Larry Withrow told NBC News.

When they caught up with him, they discovered he had a plastic baggy full of "a large amount of white powder substance" in a coffee can in his backpack, along with a scale.

One of the officers field tested the substance, and it tested positive for cocaine, Withrow said. An initial police report said Gregg was in possession of 45.91 grams of cocaine, The Oklahoman reported.

Gregg, who had previously faced drug charges, was booked at the Oklahoma County Jail on Aug. 22 and held on $50,000 bond, court records show.

But lab tests done on the substance nearly two months later determined that it was not an illegal drug, Withrow and the court records said.

Gregg then requested to have his plea withdrawn, which Judge Mark McCormick granted Thursday in the "best interest of justice after negative lab reports," the records said.

He told the judge that the powder in question was powdered milk he had gotten from a food pantry, according to The Oklahoman. He said he had pleaded guilty so he could get out of the Oklahoma County Jail after spending weeks there for a crime he didn't commit.

Gregg's public defender did not respond to an interview request. The Oklahoma County District Attorney's office, the prosecutor on the case and the Oklahoma City Police Department also did not respond to requests for comment.

Jason Lollman, a public defender in Tulsa, told NBC News that he's accustomed to clients pleading guilty — even if they're not — to get out of jail because otherwise they're "forced to sit in and wait" before and during their trial.

"The cash bail system, posting cash bail, is a problem," Lollman said. "If they can’t afford an attorney, they're not going to be able to post bond to get out."

There have often been "times where I’ve actively talked a client out of taking a plea bargain," Lollman said. But "if the client wants to take that plea, I really can’t stand in the way of it."

"Sometimes it’s like we, the attorneys, have more stamina than the clients do," he added. "But that’s because we’re on the outside and they're in jail."

Specifically, Lollman's colleagues have relayed to him that the Oklahoma City Jail, where Gregg was held, is a "generally awful jail."

"It’s not a great place to be," he said.

The Oklahoma County Jail has, for decades, had problems, including leaking walls, plumbing issues and mold, according to The Oklahoman. The newspaper reports that in the past five years, an inmate has died there about every six weeks, on average. At least six inmates have died there this year.

Requests for comment from the Oklahoma County Jail and Oklahoma County were not returned.

Guilty plea deals don't just get defendants out of jail while they await trial; they also often ensure shorter sentences or probation.

"Innocent defendants who plead guilty almost always get lighter sentences than those who are convicted at trial — that’s why they plead guilty," according to a report from the National Registry of Exonerations.

And "innocent defendants who plead guilty have an exceptionally hard time convincing anybody of their innocence," making exonerations for these defendants more unlikely.

Just about a third of the 151 known exonerations in 2018 came after guilty pleas, according to a 2019 report from the National Registry of Exonerations.

And in drug cases, once a defendant pleads guilty, a future drug test that could clear their record is rare.

This becomes a problem when field drug tests, which ProPublica says are "far from reliable" and prone to false positives, are depended on to make an arrest. Lab tests that are more accurate and could lead to an exoneration are frequently delayed because of backlog.

"The field testing of possible drugs by officers is a presumptive test only, and is simply one part of the totality of the circumstances that can lead an officer to believe that enough probable cause exists to legally effect an arrest" Withrow echoed. "The tests performed by our drug lab are clearly more sophisticated and obviously more time consuming than a simple field test."

Field drug tests are particularly detrimental to black people, who are 12 times more likely to be wrongfully convicted of drug possession than white people, according to a 2017 report from the National Registry of Exonerations.

Many of the exonerations in the U.S. came out of one county in Texas, Harris County. The county in 2014 started actively running drug tests on post-guilty plea, post-conviction cases to tackle its backlog.

"Of course hundreds of thousands of additional defendants plead guilty every year to avoid pre-trial detention in non-drug cases," the National Registry of Exonerations says. If Harris County's practice "were done across the country, we would no doubt learn of thousands of unknown false drug convictions."