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.