If the president’s comments and tweets were not a factor, many legal experts said, the court would be likely to extend the deference to the political branches it has shown in the past when considering issues of immigration and national security.

Washington lawyer Gregory G. Garre, who defended executive authority as President George W. Bush’s solicitor general, said the law makes such respect clear.

“No matter where the court ends up, the president starts with two significant pluses — the executive’s inherent constitutional authority over foreign affairs and a textually broad grant of authority by Congress to regulate the entry of aliens determined to be detrimental to the interests of the United States,” Garre said.