Updated

An Alabama sheriff who made $212,000 in the last three years by feeding inmates what a judge said were skimpy portions was released from prison Thursday after submitting a plan pledging to feed them better.

Morgan County Sheriff Greg Bartlett profited legally from a Depression-era state law that allows sheriffs to keep any money they can make by feeding inmates for less than what they receive in state funding. Bartlett said he reported the profit as income on his tax returns.

U.S. District Judge U.W. Clemon heard testimony Wednesday from Bartlett and several skinny inmates who described being forced to eat meager meals of paper-thin bologna, bloody chicken and cold grits, then paying out-of-pocket to supplement their diets with high-priced snacks from the jail's store.

"He makes money by failing to spend the allocated funds for food for the inmates," Clemon ruled after the daylong hearing in a lawsuit filed by prisoners over jail conditions.

Bartlett testified he made a $212,000 profit over the last three years to supplement his annual salary of about $64,000. Bartlett said last year's profit was $95,000: almost half of the total jail feeding budget of about $203,000 for about 300 prisoners. Bartlett said profits from the jail store are used to pay for equipment and training and don't go into his pocket.

Critics have charged that the system creates a profit incentive for sheriffs to mistreat prisoners, and Clemon said Bartlett purposely served skimpy meals to make money.

Although the practice is legal under state law, the judge ordered Bartlett to remain in custody until he submitted a plan to feed prisoners meals that are "nutritionally adequate," as required by a previous agreement in the lawsuit.

The judge ordered Bartlett's release after his lawyer submitted a plan. Its details weren't immediately made public.

Donald Rhea, an attorney for Bartlett, said Clemon would release an order later "that will serve as a guide to dispose of the issues before the court." But he declined comment on what changes will be made in prisoners' diets or whether Bartlett would give up his profits and plow the money back into food.

Attorneys for the Morgan County prisoners filed a motion that effectively would stop Bartlett from making a profit by requiring the sheriff to spend any money earmarked for food to be spent on prisoners' meals. They also want USDA guidelines used in planning menus and sought the firing of the jail's current nutritionist. The judge did not immediately rule.

U.S. Marshal Marty Keely said Bartlett was freed after spending the night at a federal prison in Talladega. It wasn't immediately known what he ate while he was there.