Updated

An Alabama sheriff was arrested Friday and agreed to plead guilty to federal charges of scamming a food bank and his own small-town church to pocket thousands under an old law that let state sheriffs profit from feeding prisoners.

Pickens County Sheriff David Abston, who held office in the rural west Alabama county for more than three decades, agreed to plead guilty to fraud and filing a false tax return, court records show.

Abston, who resigned, also agreed to forfeit about $51,000, according to a plea deal.

Although a Depression-era law changed by lawmakers this year let sheriffs profit from jail kitchens, prosecutors said Abston's setup was a scam.

"A sitting county sheriff is alleged to have defrauded a food bank and a church for his personal gain at the expense of the underprivileged that the food bank serves," U.S. Attorney Jay Town said in a statement.

The statement said Abston got his own church, Highland Baptist of Gordo, involved in the West Alabama Food Bank in 2014. Abston then wrote checks totaling some $80,000 over four years to purchase cut-rate food that was meant for the poor and wrongly used it to feed prisoners.

Abston faces more than 20 years in prison, but the plea agreement showed that prosecutors will recommend a lighter sentence. The final decision is up to a judge, and no hearing date was set immediately.

Sheriffs get state reimbursements to feed jail prisoners, and an old Alabama law let them keep any leftover funds. During the four years the scheme operated, Abston got more than $400,000 in food allowance money from the state and other government agencies, prosecutors said.

The system led to several scandals, including one a decade ago in which a federal judge briefly jailed a sheriff nicknamed "Sheriff Corndog" for feeding inmates corndogs and little else.

Another sheriff lost a reelection bid last year after reports linked food profits and a coastal condominium he and his wife purchased for $740,000. While denying any wrongdoing, then-Sheriff Todd Entrekin of Etowah County released tax forms showing he made a profit of $672,392 from the jail kitchen in 2015 and 2016.

A law passed earlier this year requires the food allowance to go into a separate account that can be used only for feeding prisoners. It also provided more money to cover the costs.

A statement released by Abston's lawyer, Augusta Dowd, said the former sheriff thanked Pickens County voters for letting him serve for 32 years.

"He believes deeply in a higher power and trusts that with the support of his friends, family, and faith, this too shall pass," Dowd said.

The county coroner will take over as sheriff on an interim basis until a successor is appointed by the governor.