By Jeff Mason and Richard Cowan

(Reuters) – A federal judge has temporarily blocked President Barack Obama's plan to protect millions of undocumented immigrants from deportation, adding a new wrinkle to a debate already raging in the new, Republican-led U.S. Congress.

Ruling in favor of about two dozen states opposed to the plan, U.S. District Judge Andrew Hanen in Brownsville, Texas, said the administration had not complied with procedure.

The White House said the Department of Justice would appeal the decision.

Obama, using his executive authority, announced a program in November to lift the threat of deportation for about 4.7 million undocumented residents. The move came after Republicans in the House of Representatives blocked bipartisan legislation that the Senate passed in 2013.

The immigration debate is sure to become a major topic of debate in the 2016 presidential campaign, which is already under way.

Republicans in Congress have linked funding for the Department of Homeland Security, which expires on Feb. 27, to blocking Obama's immigration order. Without quick action, some DHS-run programs will grind to a halt at the end of this month.

Following Hanen's order, House Speaker John Boehner and Senate Majority Leader Mitch McConnell called on Democrats to allow passage of their DHS bill in the Senate.

Obama's plan was aimed mainly at helping 4.4 million illegal immigrants whose children are U.S. citizens or legal permanent residents.

Another 270,000 people would be able to stay under the expansion of a 2012 program known as Deferred Action for Childhood Arrivals that offered deportation relief to people brought illegally to the United States as children, allowing them work. That expansion was scheduled to begin on Wednesday.

Led by Texas and its Republican governor, Greg Abbott, 26 states sued the administration to halt the programs, saying Obama's orders violated constitutional limits on his powers. They requested an injunction to block the programs from starting while the legal process plays out.

"Judge Hanen's decision rightly stops the president's overreach in its tracks," said Abbott, who took to Twitter to laud the ruling.

Republicans have said Obama's plan amounted to amnesty for people who entered the country illegally.

John Cornyn of Texas, the No. 2 Republican in the Senate, hailed the ruling but added that "the fight to reverse the president's unconstitutional overreach is not over."

The White House said the Supreme Court and Congress had made clear that the federal government can set priorities in enforcing immigration laws, "which is exactly what the president did when he announced commonsense policies to help fix our broken immigration system.

"Top law enforcement officials, along with state and local leaders across the country, have emphasized that these policies will also benefit the economy and help keep communities safe."

The administration's move had drawn praise from immigrant advocates including Hispanics, who make up a critical voting bloc that has largely thrown its support to Democrats in favor of granting relief to the 11 million undocumented people.

"We firmly believe that these programs will be implemented," said Melissa Crow, legal director of the American Immigration Council group, "and whether it's now or several months from now, we have no question that the president was well within the bounds of his executive authority."

(Reporting by Jeff Mason, Jonathan Stempel, Chris Michaud, Ted Kerr, Richard Cowan and Susan Cornwell; Editing by Nick Macfie, Susan Heavey and Lisa Von Ahn)