MIAMI — Immigration lawyers are sounding the alarm that federal funds that have long guaranteed child immigrants in U.S. custody the right to legal representation — their best shot at staying in the U.S. — are in danger of running dry.

Under U.S. law, children, though not adults, are entitled to a lawyer when they claim asylum in the United States. Unless Congress agrees to an emergency spending bill, that right could be endangered. A spokeswoman for the Department of Health and Human Services confirmed that funds would be cut off unless a bill was passed and signed by the president.

Those affected would be children brought into expanding HHS facilities, including one near Phoenix that plans to hold 50 children under the age of 5. Without a lawyer, children as young as infants could be placed in front of immigration judges to make their case for asylum on their own. Lawyers also help children stay in touch with their families and ensure that they are being treated well while in the custody of the government.

Child legal services provider Lindsay Toczylowski, executive director of the Immigrant Defenders Law Center, said recent reports of poor conditions for children inside border stations have highlighted the importance of lawyers for children in immigration custody.

"If the last few weeks have taught us anything, it is the importance of access to lawyers in protecting the rights of children in government custody. Unaccompanied children arrive often having survived unspeakable trauma, and to contemplate sending these vulnerable children into court alone, without access to a lawyer who can make sure they understand what is happening and protect their rights, is unconscionable," Toczylowski said.

Until Congress passes and the president signs a border appropriations bill now being debated, attorneys servicing new facilities, including two on military bases in Texas and Oklahoma, will not be funded.

Late Tuesday, the House passed a version which would restore funding, but the Senate has yet to pass its version of the bill, which the president must then sign.

The White House has threatened to veto the House version of the bill because it does not include funding for border security.

A spokeswoman for HHS said that "under federal law, only services to address the emergencies involving the safety of the life of the child can continue to be funded," if Congress does not pass the bill.

She added that the agency does not want to make these reductions to legal services, but "the law requires us to do so until Congress appropriates additional funds."

Under federal law, HHS is required to arrange for a lawyer for unaccompanied migrant children, but not specifically required to pay for the representation. Migrant children typically do not have funds to pay for their own representation.

Shaina Aber, the program director of the Vera Justice Institute, sounded the alarm in an email to legal service providers that was obtained by NBC News.

The Vera Institute provides the legal services under a contract with HHS’ Office of Refugee Resettlement, or ORR.

"Vera's priority is to ensure uninterrupted legal access and representation for every child placed in ORR custody," she wrote. "We are NOT willing to compromise on this point and we do not concede that makeshift solutions, such as a recorded [know your rights] video, are an adequate replacement for the vital services you provide."

According to the letter, "ORR's counsel has reached the conclusion that the Anti-Deficiency Act bars them from entering into 'any new legal commitments,'" which a spokeswoman for the agency confirmed.

On a tour of the Casa Padre Shelter in Brownsville, Texas, at the height of family separations, NBC News was shown a kiosk where flyers advising child migrants of their rights and contact information were posted next to telephones used to call attorneys and family members. If funding runs out, lawyers would not be paid for providing the legal services to migrant children at the new temporary facilities being set up to alleviate overcrowded HHS facilities.

"This is clearly not acceptable, and we have conveyed as much to ORR," Aber continued in her letter. "We disagree with ORR's narrow interpretation of its available choices under the executed contract and we are working with our counsel to request clarity as well as to ensure that, regardless of financial obligation/remuneration, legal access is not denied and that NO CHILD is placed in a facility that attorneys cannot access."

She also pushed back on restrictions to counsel inside the new temporary facilities, saying "the notion that children — many with acute trauma — would be detained and denied legal services at an (HHS facility) when we have at least a month's worth of funding available to provide services is illogical and unacceptable to us."

Julia Ainsley reported from Washington.