An Alabama sheriff has personally pocketed $1.5 million in federal funds intended to feed illegal immigrants housed in a detention center he runs — and it was all legit, according to a report.

Sheriff Todd Entrekin acknowledged last March that he kept more than $750,000 in unspent food money at the Etowah County Detention Center between January 2015 and December 2017.

But records show he actually took in twice that amount, AL.com reported on Sunday.

Entrekin, like many Alabama sheriffs, used a Depression-era state law that allows them to keep funds meant for jail food, but Entrekin is the only one who detains illegal immigrants for the federal government.

A review of county and sheriff’s office records revealed how much Entrekin benefited financially from the federal contract, AL.com reported.

Beginning in October 2011, the surplus from feeding federal inmates over the next three years amounted to more than $3 million — half of which Entrekin pocketed and half of which went to the county’s general fund.

County officials confirmed AL.com’s findings.

“The check has always been made out to him as sheriff,” said Kevin Dollar, Etowah County’s chief financial officer.

Entrekin, who will leave office next month after losing a Republican primary election in June, did not respond to requests for comment from AL.com.

But he blamed the election loss on an AL.com report that showed Entrekin bought a $740,000 beach house the year before after getting the $750,000, which led many to dub him the “Beach House Sheriff.”

Jessica Vosburgh, executive director of the Adelante Alabama Worker Center advocacy group, said the revelations about Entrekin should prompt the feds to stop sending detainees to Alabama.

“I think, based on this information, [the federal government] unequivocally needs to terminate its contract with Etowah County. This is not a reputable, law-abiding partner for the federal government,” Vosburgh said.

The detention center in Gadsden, about 65 miles east of Birmingham, usually houses about 850 inmates — of whom about 300 are illegal immigration detainees.

Inmates have long complained about the quality of the food and the small portions they receive.

“We used to eat what we got: porridge in the morning, bread, jam, one or two more items [each day]. The food that we got was not enough,” Sanju Rajput, an Indian citizen who was detained at Etowah for two years after being refused asylum in 2014, told AL.com.