Senators came to agreement Thursday on a disaster relief deal that would set aside more than $3 billion for farmers hit by Hurricane Michael and other recent storms, signaling an end to a bitter partisan fight that had blocked the flow of aid for months.

The $19.1 billion spending deal would also assist Georgians hit by tornadoes earlier this year and help peach and blueberry farmers crippled by a late-season freeze in 2017.

It would appropriate money to restore highways, wastewater infrastructure and military bases harmed by storms across the country in 2018 and 2019, as well as set aside more than $900 million to aid Puerto Rico’s recovery from Hurricane Maria in 2017. That last item was the biggest priority for Democrats throughout the negotiations.

Senate GOP leaders said the deal was endorsed by President Donald Trump, who had rejected earlier offers because of the Puerto Rico funding.

The president agreed to the plan after speaking by phone to Georgia U.S. Sen. David Perdue, a close political ally, and Senate Appropriations Chairman Richard Shelby of Alabama. His administration had previously said the emergency package must include unrelated funding for the southwest border, but it dropped those demands after negotiations broke down late Wednesday.

The final Senate vote was 85 to 8.

“I’m disappointed it took so long,” said U.S. Sen. Johnny Isakson, R-Ga. “But not withstanding anything else, Georgia farmers who have been in deep trouble and needed the money a long time ago are going to get the money, and it's going to help us to stabilize the farm market and ...farm families in Georgia.”

Members of the House, who have already fanned out across the country for their Memorial Day recess, could approve the bill by voice vote by the end of the week, but a roll call vote in early June is also possible.

“If the Senate passes the legislation today, House Democrats support clearing it through the House as soon as possible," said Evan Hollander, a spokesman for the Democrat-led House Appropriations Committee.

The agreement came more than seven months after Hurricane Michael devastated the Southeast, making landfall as a historic Category 5 storm. The hurricane killed 45 people and created more than $2.5 billion in damage to Georgia agriculture alone.

Georgia's political leaders had for months pleaded with Congress to approve the disaster relief money, which had broad bipartisan support. But the issue quickly became lumped in with the radioactive Puerto Rico fight, as well as the White House's last-minute border request.

The Senate’s action on Thursday represented a remarkable turnaround. Hours earlier, the package appeared to be on the brink of failure as negotiators struggled to agree on immigration-related provisions.

Perdue credited Trump with the political breakthrough.

"Today the president acknowledged he was going to fulfill his promise to these disaster victims and have their back, and I think today in a bipartisan way Congress backed him up on that, so I'm delighted with this outcome ,” the Republican told reporters.

Throughout the disaster relief debate, Trump called Puerto Rico an ineffective steward of taxpayer money. As recently as Monday, he repeated an erroneous claim that Washington had already sent $91 billion to the island.

Senate Minority Leader Chuck Schumer, D-N.Y., said Trump’s insistence on Puerto Rico and immigration funding were what prevented a deal.

“The president interfered twice and slowed it down,” he said.

The money may be too little too late for some Georgia farmers. The planting season for some crops began months ago, and in order to get by, some farmers chose to mortgage off portions of their land - while others sat out entirely. 

It’s still unclear how much money Georgia will ultimately receive from the disaster relief bill. Once approved, federal agencies will divvy up the money and develop formulas and regulations to determine what individual farmers, governments and development authorities will receive based on need.

Cox Media Group’s Jamie Dupree contributed to this article.