Mississippi River flooding in Missouri. (Scott Olson/Getty Images)

The House passed a long-delayed aid bill on Monday that will send $19.1 billion to states and territories hit by flooding, wildfires, tornadoes, hurricanes and other natural disasters in recent months.

The legislation passed by a wide bipartisan margin, 354 to 58, and now goes to President Trump. The president has described the bill as “great” and is expected to sign it.

The vote ended a months-long saga on Capitol Hill as the disaster bill, typically a bipartisan affair, fell victim to grinding delays.

The legislation languished for months as Trump and Democrats fought over aid to Puerto Rico, which will ultimately receive more than $1 billion in the bill. There were also internal squabbles among Republicans, a fight over immigration and, finally, after the Senate passed the bill last month, objections by a handful of conservatives in the House who prevented the bill from passing while Congress was out of town for Memorial Day.

As the months passed, additional natural disasters hit the United States and the bill had to be rewritten to address some of them, particularly the flooding in the Midwest.

In its final form, the legislation will fund numerous federal programs that provide aid and rebuilding assistance to local communities, farmers, service members and others nationwide.

“Today we are rejecting the political stunts and grandstanding that have made it difficult to deliver much-needed disaster relief to families and communities across America,” House Appropriations Chairwoman Nita M. Lowey (D-N.Y.) said Monday on the House floor. “While it has taken far too long, this bill delivers much-needed assistance to American communities struck by recent natural disasters.”

Senate Appropriations Chairman Richard C. Shelby (R-Ala.) told reporters that the long delays on the bill “should never have happened.”

“I think we could do better,” Shelby said. “I don’t think it was our best show.”

Shelby and other lawmakers have fretted that their difficulty in reaching agreement on the disaster bill bodes poorly for Congress’s ability to deal with even more consequential issues ahead, including a government shutdown deadline Sept. 30 and the need to raise the federal borrowing limit or face default about the same time.

Among many other provisions, the disaster legislation contains $2.4 billion for community development block grants to address disasters that have occurred since 2017; $3 billion for the Agriculture Department to cover producers’ losses from those disasters; and $720 million for the Forest Service to repay money spent fighting last year’s wildfires.

The bill is among the most sweeping pieces of disaster legislation to have been considered by Congress, in the scope of aid and the multitude of disasters addressed. These included Hurricanes Maria, Florence and Michael; Typhoon Mangkhut, Super Typhoon Yutu and Tropical Storm Gita; plus wildfires in California, volcanic eruptions in Hawaii and an earthquake in Alaska.

The magnitude of the legislation underscores the recent frequency of extreme weather events in the United States.

The bill also extends the National Flood Insurance Program through Sept. 30, and includes a provision pushed by Senate Majority Leader Mitch McConnell (R-Ky.) to ensure that industrial hemp will be covered by federal crop insurance.

On Puerto Rico, Trump had resisted including any money at all, accusing the island’s leaders of mismanagement and vastly inflating how much disaster aid Puerto Rico already had received as it recovers from Maria. Painstaking negotiations persuaded the White House to go along with the money in the bill, which includes $600 million for Puerto Rico’s food stamp program and $300 million for block grants.

Provisions were also included to ensure faster access for Puerto Rico and other places to Housing and Urban Development funds that already had been approved by Congress. The bill includes language pushed by the White House aiming to ensure good fiscal stewardship of the money the territory receives.

The White House had sought to attach a $4.5 billion emergency spending request for the U.S.-Mexico border to the disaster bill, but agreement could not be reached and the border piece was left out. Negotiations are ongoing, and the border spending measure could pass separately in coming weeks.