HOUSTON (AP) — The U.S. government has quietly reached a new agreement to keep open a 2,400-bed detention facility used to detain immigrant mothers and children, in a lucrative arrangement for a private prison company and the tiny South Texas town where it’s located.

U.S. Immigration and Customs Enforcement last month signed a contract with the city of Dilley, where the South Texas Family Residential Center opened in 2014. Dilley signed a contract at the same time with CoreCivic, the private prison operator that runs the detention center, the largest facility of its kind in the U.S. The city released both contracts to The Associated Press last week in response to an open records request.

ICE said it was replacing an arrangement dating to President Barack Obama’s administration that the Department of Homeland Security’s inspector general criticized this year as violating budget guidelines and wasting money. But the new arrangement has some of the same features the inspector general criticized.

When it opened the facility in 2014, the U.S. was seeing a surge of women and children immigrating from Central America. ICE argued it had an urgent need for family bed space and had to circumvent government standards for contracting, which require a bidding process and extensive reviews.

ICE modified an existing detention agreement with the city of Eloy, Arizona, to include the Dilley facility, 900 miles away. Eloy technically ran the facility, but routed ICE money to CoreCivic, then known as the Corrections Corporation of America.

The inspector general said in a February audit that ICE improperly modified the Eloy contract and that it should have avoided creating a “middleman” and reached an agreement directly with the company operating the facility. Also, not conducting a bidding process may have led ICE to overpay for services at the detention facility, the audit said.

ICE spokeswoman Nina Pruneda said Tuesday that the agency created the agreement with Dilley in response to the inspector general’s concerns about Eloy, and that all other terms of the contract will remain the same.

ICE will pay Dilley about $13 million a month for the cost of detaining immigrants at the facility. Dilley will then send almost all of that money to CoreCivic, minus administrative fees that add up to an estimated $438,000 a year.

That’s a significant windfall for a city with a population of about 4,000 people that has an annual budget of $2.1 million. Dilley already collects annual revenue-sharing payments from CoreCivic, with $200,000 due in December.

CoreCivic will continue operating a facility that generated $171 million in revenue last year.

ICE retains use of a facility that provides most of the 3,000 beds it has in family detention. That space is particularly critical as President Donald Trump’s administration tries to detain immigrant families for longer and waive restrictions on the detention of children.

But immigrant advocacy groups say the contracts preserve an arrangement in which a local city’s oversight is a technicality that lets ICE and CoreCivic to operate without public scrutiny.

Claudia Valenzuela, director of the National Immigrant Justice Center’s detention project, said the city, ICE and CoreCivic should explain how they reached the agreement. She questioned whether Dilley would actually be overseeing the facility given the money it is receiving from CoreCivic.

“I don’t have too much faith … that there’s going to be a whole lot of pushback,” she said.

Neither ICE nor CoreCivic announced the new agreement. The Dilley City Council met in closed session on Sept. 17 to discuss the two contracts, and interim city administrator David Jordan signed them one day later.

Both Jordan and Dilley Mayor Mary Ann Obregon, declined to comment on the agreement. CoreCivic also declined to comment.

Bob Libal, executive director of the group Grassroots Leadership, said ICE may have wanted to avoid the attention that other detention contracts have gotten. One county in Central Texas this year terminated its agreement with ICE and CoreCivic for a 500-bed facility long protested by Grassroots Leadership and others.

“It’s an agency that tends to play by its own rules,” Libal said.

Located on the site of a former “man camp” for oilfield workers, the family residential center is a major engine of jobs and taxes in Dilley. CoreCivic runs ads in the local newspaper advertising positions that start as high as $20 an hour, and Obregon wrote a public letter last year lauding the facility.

ICE says detainees at Dilley are well cared for, with access to medical care and legal help.

But legal groups say immigrants are often traumatized by detention at Dilley and that some struggle to get health care.

There are 1,975 people currently detained there. Some of the families at Dilley were reunited in detention after being separated under the Trump administration’s “zero-tolerance” policy that was halted in June.

(© Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)