WASHINGTON (AP) — The Defense Department has completed legal and environmental requirements needed to create housing at a Texas military base for unaccompanied children who were detained after crossing the U.S.-Mexico border illegally.

The department is now waiting for a formal request from the Department of Health and Human Services. According to the Pentagon, a letter from HHS is required before the actual construction of temporary housing or tents can begin at Goodfellow Air Force Base near San Angelo, Texas. Once that request comes in, the military can begin clearing the land.

Federal officials, however, are still working on the legal framework for the use of Fort Bliss, in El Paso, Texas, to house immigrant families caught crossing the border illegally.

The progress of the two requests comes as close to two dozen retired military officers sent a letter to Defense Secretary Jim Mattis opposing the housing plan, saying it creates more risk by requiring U.S. forces to focus on asylum-seekers rather than national security threats.

"Housing thousands of detained migrants at these installations over an extended period of time will divert critical defense resources from core military functions, reduce service member readiness, and detract from their ability to protect our homeland and defend our interests abroad," they said in the letter.

Mattis, however, has said the practice is in line with historical precedents for military assistance.

"We have housed refugees, we have housed people thrown out of their homes by earthquakes and hurricanes; we do whatever is in the best interest of the country," he told reporters last month when asked about the plans. But he also has insisted that decisions about immigration policy and its security implications are not his to make. "I'm not going to chime in from the outside," he said.

It's been about two and a half months since HHS officials first said the agency was looking for space at military bases to house up to 20,000 unaccompanied minors. The agency initially looked at four bases, but that was narrowed down last month.

In addition, the Department of Homeland Security last month formally requested space for up to 12,000 beds for families, including 2,000 beds that would be up and running in the next 45 days, and the remaining available on an as-needed basis.

The Pentagon said developing the legal agreement for the family housing is taking additional time because it is more complicated.

A family facility must comply with Immigration and Customs Enforcement's family residential standards, as well as a 1997 agreement known as the Flores settlement, which governs how children are housed in immigration custody. Those standards require air conditioning, libraries, private showers and medical, dental and mental health facilities. Those rules also state there must be freedom of movement within the facility during the day.