President Barack Obama has signed a law funding the Homeland Security Department through the end of the budget year. 

The president signed the bill Wednesday afternoon in the Oval Office with a small group of photographers present. The White House wouldn't permit reporters to attend. 

The House voted 257-167 Tuesday to approve the bill after a messy fight in Congress. Republicans wanted to use the legislation to repeal Obama's executive actions on immigration. Congress extended funding for one week just ahead of last Friday's deadline, then Republicans relented Tuesday and approved full-year funding without the immigration conditions. 

Obama has said Congress took far too long to approve the funding. Without action, funding would have expired at midnight Friday, furloughing some workers while requiring others to work without receiving their paychecks.