Not so long ago, former BP engineer Kurt Mix was facing a possible 20-year sentence, charged with felony obstruction of justice for deleting text messages that dealt with how fast oil was being released during the 2010 Gulf of Mexico oil spill.

But nearly three years after he was indicted, Mix accepted a plea deal Friday under which he won’t have to spend a day in jail.

Federal prosecutors agreed to drop the obstruction charge in return for his guilty plea to a far less serious count of intentionally causing damage without authorization to a protected computer — a misdemeanor. Mix was sentenced to six months’ probation and 60 hours of community service, avoiding the need for a second trial that was set to begin later this month.

Though he entered a guilty plea, the deal was clearly a victory for the quiet engineer, who told reporters outside the courthouse that his experience in the case made him question the American system of justice.

His attorney was more pointed still, saying the government had pushed a “false narrative” about Mix in a desperate effort to hold someone criminally liable for the 2010 spill.

Indeed, the tepid resolution of Mix’s case marked another setback in the government’s yearslong push to hold individuals — rather than just corporations — accountable for the accident, which killed 11 men and led to the worst environmental disaster in U.S. history.

More than five years after the blowout, the government has few victories to tout. Only one of the five men charged was a high-ranking executive. With Mix’s plea, the dragnet so far has netted one acquittal and two guilty pleas. The other plea came from a former Halliburton manager who, like Mix, was sentenced to probation in connection with destroying evidence after the spill.

Charges are still pending against two other men.

Mix, of Texas, is the only person to date found guilty at a trial in connection with the Deepwater Horizon disaster. But his 2013 conviction was overturned last year when a federal judge granted him a new trial, citing juror misconduct.

“Before this case, I knew very little about our justice system and how it worked,” Mix, 54, told reporters Friday in brief prepared remarks after the proceeding. “Still, I believed that it was about getting to the truth. I was wrong.”

Though he faced the possibility of two decades behind bars if convicted of the obstruction count, legal experts speculated that federal guidelines would have called for a sentence of about 18 months.

Mix played no part in the fire and explosion aboard the drilling rig, or in the well-documented missteps by BP and its partners ahead of the disaster. Instead, he was brought on by BP after the blowout to analyze how much oil was gushing into the Gulf. He determined that oil was flowing at a rate of 64,000 to 110,000 barrels a day. At the time, BP was publicly claiming that only 5,000 barrels of oil were being released each day.

During Mix’s change-of-plea hearing Friday, U.S. District Judge Stanwood Duval Jr. noted from the bench that Mix’s alleged misdeeds “occurred after the explosion,” and he credited Mix for his hard work in “stopping the flow of that well.”

“That needs to be noted,” the judge said.

After Mix’s prepared remarks, his attorney, Joan McPhee described Friday’s resolution as “a tremendous vindication.”

During his 2013 trial, prosecutors alleged that Mix deliberately deleted the messages to hinder the government’s probe and hide what BP executives knew about how much oil was flowing from the well. Mix’s defense argued that the messages were mostly irrelevant exchanges with friends. All but 17 of the deleted messages were later recovered by forensic experts.

Many of the recovered messages were read in court. Most were mundane. However, some dealt with the central issue of the rate at which oil was flowing from BP’s runaway well.

But the government’s eventual capitulation demonstrated “a total unraveling of the Department of Justice’s false narrative about Kurt Mix after four long years of investigation and prosecution, and millions of dollars in taxpayer money,” McPhee said.

Pleading to the lesser count, she said, meant Mix acknowledged that he had deleted the exchanges, which she contended had “only glancing references” to the oil spill response.

McPhee said the case paralleled the recent acquittal of David Rainey, BP’s former vice president of exploration for the Gulf, who was accused of trying to mask the severity of the oil spill.

In June, Rainey was acquitted of a charge of making false statements to federal investigators who were probing the disaster in 2011.

Rainey became the second former BP worker to be tried in connection with the deadly accident. By the time he faced a jury, Rainey’s charges had also been reduced; a different federal judge dropped a pending charge of obstruction of Congress because of concerns about whether he could present a full defense at trial.

“Mr. Rainey and Kurt Mix together stand vindicated of any charge that either ever acted to obstruct justice,” McPhee said, “so that is something that both Mr. Rainey and Mr. Mix have been able to fully put behind them with the outcomes in these cases.”

U.S. Department of Justice spokesman Peter Carr declined to comment Friday, as did BP spokesman Geoff Morrell.

Some legal experts who have followed the criminal cases have been critical of the government’s effort to hold individuals criminally liable for the spill.

Michael Magner, who represented Rainey at trial, said the Justice Department’s Deepwater Horizon Task Force has been “really problem-plagued.”

“This is a very poor result for the government,” Magner said of the Mix plea. “I think it’s a reflection, as much as anything, that this man does not want himself and his family to have to go through another trial.”

Other observers say it’s difficult for the government to hold individuals accountable for the real causes of the spill, which they believe was BP’s larger track record and corporate culture.

“BP had a terrible corporate culture that placed profit-making and risk-taking over safety and environmental protection, which made a tragedy like the Gulf oil spill possible,” said David Uhlmann, a law professor at the University of Michigan and former chief of the Justice Department’s Environmental Crimes Section. “For better or worse, however, it’s difficult to criminally prosecute any individuals for the corporate culture that was the primary cause of the spill.”

BP’s top supervisors on the rig when it exploded are set for trial next year, although they will face fewer charges than they did when first indicted in 2012. Robert Kaluza and Donald Vidrine are accused of misinterpreting a key safety test and ignoring signs the well was in jeopardy.

An attorney for Kaluza, former federal prosecutor Shaun Clarke, declined to comment Friday.

The men are charged with 11 counts of involuntary manslaughter and with violating the federal Clean Water Act. If convicted, they face a maximum of eight years for each manslaughter count and up to a year in jail on the Clean Water Act charge.

Given how things have played out in the other cases, Magner, a former federal prosecutor himself, expects the government will be feeling the pressure to deliver results in the remaining case. But it’s far from a sure thing, he said.

“The 800-pound gorilla in the room is that both of these men were on the very rig that exploded and had the blowout and resulted in the oil spill,” he said. “It’s one thing to impose civil liability for negligence in connection with that, but it’s an entirely different thing to charge somebody with criminal conduct for causing a major disaster when they themselves were in the scope of the very danger.”