“Congress did not intend to make immune from judicial review an agency action that reclassifies millions of illegal aliens in a way that imposes substantial costs on states,” Judge Smith wrote. He rejected the administration’s argument that the program was just an expansion of an immigration enforcement policy intended to make efficient use of limited resources.

Ken Paxton, the Texas attorney general, hailed the ruling in a statement. “Today, the Fifth Circuit asserted that the separation of powers remains the law of the land, and the president must follow the rule of law, just like everybody else,” he said. “Texas, leading a charge of 26 states, has secured an important victory to put a halt to the president’s lawlessness.”

In the last several weeks, administration officials and other supporters of the immigration actions had expressed frustration that the appeals court had taken so long to rule. If the Fifth Circuit court had waited too long to allow an appeal to the Supreme Court, Mr. Obama’s hopes of carrying out his program before he leaves office in 2017 would have all but ended. As it stands, if the Supreme Court overturns the lower-court rulings, the administration would have only a few months to begin signing people up.

Marielena Hincapié, the executive director of the National Immigration Law Center, said that while the appeals court ruling might be seen as another defeat for her cause, “the silver lining is that this is just in the nick of time for the administration to go to the Supreme Court.”

Mr. Obama has asserted that the immigration program would merely direct federal agents not to enforce deportation laws against a certain group of people. But the appeals court suggested that the president had exceeded his authority by using the program to grant benefits without a congressional mandate.

In a blunt dissent, Judge Carolyn King said the two other judges, as well as Judge Andrew S. Hanen, the District Court judge, had misstated the basic facts of the case. She accused her colleagues of basing their decisions on “conjecture, intuition or preconception.”