Congress has delivered the first installment of federal relief to the states ravaged by Hurricane Harvey, approving $15.25 billion as part of a package that includes a three-month extension of government funding and an increase in the debt ceiling.

The House on Friday morning passed the legislation on a 316-90 vote, acting barely 72 hours after President Trump struck an agreement with Democratic leaders to attach the stopgap spending and debt measures to the bill and postpone a fiscal standoff until December. The Senate approved the bill on Thursday on a vote of 80 to 17, and it now goes to Trump for his signature.

With a second and potentially more devastating hurricane about to hit Florida, it was a notably swift response from a Congress that has struggled to enact significant legislation in the first year after Republicans won full power in Washington. The first tranche of federal assistance will arrive in Texas and Louisiana less than two weeks after Harvey slammed into Galveston and then flooded Houston with more than 50 inches of rain. And the $15.25 billion is likely only a fraction of what Congress will ultimately have to send in disaster relief this fall: Texas and Louisiana are expected to seek tens of billions more for long-term reconstruction efforts, and lawmakers might have to act just as quickly if Hurricane Irma causes similar damage to Florida. It’s already caused widespread destruction in the U.S. Virgin Islands and Puerto Rico.

Earlier in the week, the House in a nearly unanimous vote had approved $7.85 billion in Harvey aid. But the Senate added an additional $7.4 billion to fund community-development block grants to help the affected areas rebuild, along with the temporary extensions of federal funding and the debt ceiling. The bill also included a three-month extension of the National Flood Insurance Program, which was set to expire on September 30.

While the storm relief was the most important piece of the legislation, this week’s votes also represented one of the more remarkable political moments of Trump’s first term, as Republican majorities in the House and Senate ratified an agreement the president sealed with Democrats over the objections of both House Speaker Paul Ryan and Senate Majority Leader Mitch McConnell. The deal came together rapidly at the end of an hour-long meeting at the White House on Tuesday, when Trump acceded to demands from Senate Minority Leader Charles Schumer and House Minority Leader Nancy Pelosi that the Harvey package include only a short-term increase in the debt limit. Ryan and McConnell had wanted a much larger increase that would last through the 2018 elections, to shield Republican lawmakers from another politically painful vote and to block Democrats from demanding additional concessions in exchange for their votes.

Trump’s decision stunned Republican lawmakers, who suddenly found themselves on the wrong side of an impulsive president’s desire to claim a bipartisan win. “The word that comes to my mind is bewilderment,” said Representative Mark Walker of North Carolina, chairman of the conservative Republican Study Committee and generally an ally of the president. “I think this caught everybody a little bit off-guard,” he said in an interview Thursday evening. Walker voted against the package on Friday.

The White House spun the agreement as a way for Trump to “clear the decks” for a push on tax reform, and the president made clear that he wanted a show of bipartisanship as the nation faced not one but two natural disasters. Yet the votes in Congress were less a kumbaya moment than another display of Republican division. While the legislation won unanimous support of Democrats in both chambers, GOP lawmakers were torn between the desire to show support for the regions devastated by Harvey and their anger at the deal Trump signed off on. Trump sent Treasury Secretary Steven Mnuchin and Mick Mulvaney, his budget director and a former fiscal hard-liner, to Capitol Hill on Friday to round up some last-minute votes, but the effort appeared to move few members. While the bill won a majority of House Republicans, the 90 who voted against the agreement were mostly conservatives, including a large chunk of the House Freedom Caucus and even four members representing Texas. Opposition also came from four committee chairmen, including two from Texas: Representatives Jeb Hensarling, head of the Financial Services Committee, and Mac Thornberry, who leads the Armed Services Committee.

Other GOP lawmakers swallowed hard and voted for an agreement they did not like. Representative Trey Gowdy of South Carolina said in a statement that increasing the debt limit without fiscal reforms was “irresponsible” and that funding the government in three-month increments is “far from ideal.” But he voted yes anyway. “Despite my disappointment, I refuse to punish my fellow citizens who are in desperate need of help,” Gowdy explained.

Trump was banking on that sentiment prevailing when he shook hands with Schumer and Pelosi. On Friday, the president got the votes he needed and a temporary reprieve from fiscal warfare. More significantly, Texas and Louisiana got a down payment on their long road to recovery.