The report, the result of several months of interagency legal policy deliberations, reads like a legal brief that the Justice Department might file if detainees were brought to a prison on American soil and a lawyer for one of them sought a judicial order freeing his client.

“There are a number of statutory provisions that should render Guantánamo detainees relocated to the United States inadmissible under the immigration laws,” it said. “Such inadmissible aliens should generally have a limited set of statutory and constitutional rights, even when they are physically present in the United States.”

It added that for such people detained as wartime prisoners, “any arguably applicable constitutional provisions should be construed consistent with the individuals’ status as detainees held pursuant to the laws of war, and the government’s national security and foreign policy interests and judgments should be accorded great weight and deference by the courts.”

The report works through a series of legal defenses the government would muster, including that the laws of war permit the indefinite detention of such prisoners and do not make them eligible to invoke immigration or asylum law. And even if a court nevertheless ruled that the prisoners were able to invoke those laws, it says, they restrict the release of noncitizens who are deemed potential threats to public safety or who may have committed serious crimes abroad.

The hardest question raised by detention law is what should happen if a judge orders a detainee freed because the laws of war no longer permit his detention — either because the armed conflict is over or because the facts do not support the conclusion that he was an enemy fighter — but he cannot legally be repatriated because it is more likely than not that his home country’s government would torture him.