A lengthy government shutdown over border wall funding has potentially put Immigration and Customs Enforcement at risk of violating a more than 100-year-old law that could not only require the release of “non-dangerous” individuals in the agency’s custody but also stop it from continuing to arrest and detain certain people, according to former senior ICE officials and experts.

The potential violation could complicate ICE’s operations at a time when President Donald Trump has argued that the shutdown is necessary to force Democrats to implement tougher immigration policies, such as building a wall on the US–Mexico border.

ICE contracts with nonfederal detention facilities, like county jails and private detention contractors, across the country to hold individuals detained by immigration agents. The agency pays for the bed space in various ways, including monthly payments or, in some cases, in advance.

As of Jan. 1, the agency was detaining more than 48,000 individuals, which is 8,000 more than the levels that had been provided for by the now-expired congressional funding. But nearly three weeks after its funding lapsed because of the shutdown, ICE has likely run out of money to pay contractors for the detention space it uses.

And while ICE has some non-appropriated funds it can lean on, those are not enough to pay for the overall detention space for more than a few weeks, said Kevin Landy, who was appointed during the Obama administration to run ICE’s Office of Detention Policy and Planning, a position he held for more than six years, up until 2017.

“It's just a matter of time before ICE runs out of money to pay for detention beds, if it hasn't already,” Landy said. Already, some county governments, like in Tulsa, Oklahoma, have told BuzzFeed News that ICE has notified them that its monthly payment for the individuals in their custody will not be made on time.

Private detention companies, like CoreCivic, have also been notified by ICE that payment will be delayed until the government reopens. Both CoreCivic and some county governments, like in Tulsa; Glades, Florida; and York, Pennsylvania, have maintained that they can continue to hold ICE detainees without payment because they know the government will eventually pay.

But continuing to keep certain individuals in their custody may be a violation of a law first enacted in the 1980s known as the Antideficiency Act.

The law makes it illegal for a contractor to provide the government free services in anticipation of future payments, unless the services are necessary to protect human life or property, according to Landy.

“ICE cannot legally ask detention facilities to hold nondangerous individuals it has arrested if ICE has no funds to pay the facilities for doing so,” he said.

Tracey Valerio, the former head of budget at ICE until April 2018 and current senior counsel at Frontier Solutions, said it’s unclear whether the agency can house people without paying.

“It’s not clear that ICE can continue to incur new obligations with third parties if it runs out of funding,” she said.

CoreCivic has been told by the federal immigration agency that its work is considered “essential” during the shutdown, a spokesperson for the company said.

For its part, an ICE official who declined to be named maintained that the agency’s law enforcement activities are necessary for the safety of human life or protection of property, therefore qualifying for an exception during appropriation lapses.

“This includes detention center operations,” the official told BuzzFeed News.

ICE, however, does not operate its own detention facilities but instead rents beds, a number that fluctuates based on its needs, according to Landy.

In the early days of the Trump administration, officials eliminated Obama-era priorities for arrests during ICE operations, in effect making nearly every undocumented immigrant a priority for removal.

“Many thousands of those arrested and currently detained by ICE have no criminal record, and would not even have been arrested during the Obama administration,” Landy said. “Releasing them would not cause a risk to public safety.”

Whether ICE could be forced to release individuals is another matter, according to Landy. The Antideficiency Act includes criminal and administrative penalties but given that the decision to continue ICE’s operations was made at the highest levels, it’s unlikely the administration will invoke it.

There are, however, other parties that can get involved.

“Congress could investigate the legal violation, or ask the US Government Accountability Office to conduct an audit,” he said. “And the appropriations committees could then impose more severe restrictions on the agency's use of its detention funds in future legislation.”

Charles Tiefer, a University of Baltimore Law School professor and expert on the Antideficiency Act, said that he believed ICE would be in violation of the law for housing nondangerous individuals.

“It’s in the gray zone,” he said. “On the one hand, ICE would say it is not formally obligating itself to pay anything. It is not writing a letter promising ‘we will pay the bills.’ On the other hand, ICE is fostering an understanding by the contractor that it will be paid.”

But Tiefer said he believed it was a violation of the act because “the government will be pressured, and rightly so, to pay the bills later, and the government is ... fostering the understanding that it will pay the bills. As the old saying goes, a wink is as good as a nod.”

Even without the potential violations of the law, should the shutdown continue, the agency could run into issues with jurisdictions not receiving payments for months on end. In Tulsa County, Casey Roebuck, a spokesperson for the sheriff’s office, said that while the department had some “wiggle room” to maintain detentions for ICE should funds not be received in the near future, that could become an issue as time goes on.

“You’re looking at anywhere from $300,000 to $150,000 a month that we bill,” she said. “That’s a lot money for the county to absorb and to carry until we start getting payments again. We are hoping it gets worked out before it becomes a problem.”

Hamed Aleaziz is a world correspondent for BuzzFeed News and is based in San Francisco.