U.S. President Barack Obama accused Republicans of holding the Department of Homeland Security “hostage” over immigration policy during a town hall discussion Wednesday at Florida International University in Miami, a week after a Texas judge ruled to block Obama’s executive actions to allow as many as 4.7 million undocumented immigrants in the United States to stay and obtain work permits. The president also defended his immigration policies and pledged to veto any bills declaring them illegal, as lawmakers brace for a partial agency shutdown at the end of the week.

“Instead of trying to hold hostage funds for the Department of Homeland Security -- which is so important for our national security -- fund that and let’s get on with actually passing comprehensive immigration reform,” Obama said during the bilingual interview, which was sponsored by Telemundo and MSNBC.

The Homeland Security budget has been shackled for weeks as GOP lawmakers sought to block the department's funding unless Democrats agreed to reverse Obama's executive orders on illegal immigration. Money for the agency will run dry Friday night unless congressionals act, Reuters reported.

Obama said during the televised meeting Wednesday that the Department of Justice has “very aggressively” appealed the Texas court's decision to temporarily stop his immigration policies. Obama said the legal battle will take months, but he is “confident” his administration will win as the case goes through higher courts. “We believe that the law is clearly on our side,” he said Wednesday.

The state of Texas filed suit against the federal government in December on behalf of a coalition of 26 states, asserting Obama had exceeded his presidential authority on immigration policy last year. U.S. District Court Judge Andrew S. Hanan ruled Feb. 16 that the states proved they are likely to suffer “irreparable harm” from the effects of the deferred action programs.

Obama said his executive orders to allow millions of illegal immigrants the opportunity to obtain legal status, driver’s licenses, work permits and other government benefits are within his presidential authority, but the programs are temporary until Congress passes a comprehensive bill. “I am absolutely confident that what we’re doing is the right thing to do,” he told an audience of immigrant youth. “Now the question is how can we get a law passed?”

The president also strongly refuted questions about whether Democrats and Republicans were “playing political ping pong” with immigration policy. “That’s just not true,” Obama said, visibly annoyed. “This is not a game.”

After months of fighting with a divided Congress over immigration reform, Obama announced in November he would act unilaterally to increase resources and law enforcement personnel at the borders and to take steps to deal with the millions of undocumented immigrants who already live in the United States.