President Donald Trump signed bipartisan legislation Thursday to fund much of the Department of Homeland Security, bringing an abrupt end to the longest DHS shutdown on record after weeks of political blame and negotiation. The House approved the bill by voice earlier Thursday, and Trump signed it shortly after the final House action.

The shutdown began after DHS lost routine funding on Feb. 14, with the White House warning that temporary funding Trump had used to pay some Transportation Security Administration and other personnel would soon run out. In practice, many immigration enforcement operations kept running during the lapse using other funding sources, even as DHS workers faced uncertainty that included missed pay risk for some and turmoil over possible furloughs as the standoff dragged on.

“It is about damn time,” Rep. Rosa DeLauro of Connecticut, the top Democrat on the House Appropriations Committee, said. DeLauro proposed the bipartisan bill more than 70 days earlier, and the House moved quickly to pass the measure without a formal roll call.

The episode also unfolded under heightened scrutiny of DHS leadership and staffing. The agency came into the fight after Trump ousted Kristi Noem as the department’s leader, installing Oklahoma Sen. Markwayne Mullin in the middle of the shutdown. The DHS workforce includes roughly 260,000 employees across TSA, the Coast Guard, FEMA and other operations.

Democrats and Republicans tied the fate of the funding package to differing approaches to immigration enforcement. After fatal shootings of Renee Good and Alex Pretti, both described as U.S. citizens, by federal agents during protests against immigration actions in Minneapolis, Democrats refused to fund ICE and the Border Patrol without changes to those operations. Republicans, meanwhile, would not accept a plan that would fund TSA and other DHS components while excluding money for ICE and the Border Patrol.

As the dispute intensified, the federal shutdown affected daily life, including hourslong lines for airport security screening, while a Senate-approved version of the package had already cleared without the immigration-related funds in a middle-of-the-night vote about a month earlier. After that, the bill stalled in the House. House Speaker Mike Johnson, R-La., had previously called the legislation a “joke,” but Republican leaders later paired the broader bill with separate treatment for immigration enforcement funding.

To break the impasse, Republican leaders in both the House and Senate decided to pursue immigration-enforcement funding on their own through budget reconciliation, a weekslong process. By beginning that track with a separate vote late Wednesday night, using a GOP budget resolution that could provide about $70 billion for immigration and deportation operations through the remainder of Trump’s term in 2029, Johnson said he helped unlock the bipartisan DHS package that covered the rest of the department.

Johnson acknowledged Thursday that after he had criticized the bipartisan DHS bill earlier, the new budget process ensured the immigration enforcement money would eventually flow “with no crazy Democrat reforms.” He said, “We threw a fit. We had to.”

Not all Republicans supported separating immigration enforcement funding from the larger package. During Thursday’s quick floor action, Rep. Chip Roy of Texas said isolating the immigration-related money on a separate track was “offensive to the men and women who serve in ICE and Border Patrol, and are serving this country every single day.”

Even before the bill’s signing, the White House pushed lawmakers to act, warning that the temporary money Trump had used for TSA and other agency personnel would “soon run out.” The AP report said immigration enforcement workers had largely been paid through new cash Congress approved as part of Trump’s tax cuts bill last year—some $170 billion—while other components, including TSA, depended on Trump’s executive action to avoid pay disruptions. Mullin said recently that the available funds were dwindling, and on Thursday he posted on social media that the shutdown “NEVER should have happened.”

Service disruptions were accompanied by workforce strain. According to Airlines for America, more than 1,000 TSA officers quit since the shutdown began. Everett Kelley, national president of the American Federation of Government Employees, said workers were “pleased that Congress finally stepped up to do their jobs and fund DHS” but that it was “unacceptable that it took them this long to do so,” adding that “federal employees are not political pawns. They are not leverage. They are Americans -– and they deserve to be treated with dignity and respect.”

The immigration enforcement funding fight now moves to the reconciliation steps Republicans started, which lawmakers said would involve drafting the actual $70 billion ICE and Border Patrol funding bill after the budget resolution. Voting is expected in May, with Trump saying he wants the legislation on his desk by June 1.