A former BP engineer who was accused of deleting text messages about how much oil spewed into the Gulf during the 2010 spill pleaded guilty Friday to a lesser charge and was sentenced to six months of probation.

Kurt Mix had been fighting an obstruction charge for more than three years. In federal court in New Orleans, he pleaded guilty to intentionally causing damage without authorization to a protected computer.

Mix had been part of a BP team trying to stop an underwater gusher of oil. Prosecutors say that after the spill, he deleted text messages he had exchanged with a contractor during the spill.

The prosecution recommended probation and a judge agreed.

Defense attorney Joan McPhee said the texts were mostly personal exchanges, with only scant reference to the spill. She said the federal prosecutors pursued the case recklessly.

Mix told reporters he's glad the ordeal is over. Justice Department lawyers declined immediate comment.

At a 2013 trial, he was acquitted on one obstruction charge and convicted on another. But he won a new trial on that conviction because of juror misconduct.

The Associated Press contributed to this report.