WASHINGTON — President Donald Trump lashed out at hurricane-devastated Puerto Rico on Thursday, insisting in tweets that the federal government can’t keep sending help "forever" and suggesting the U.S. territory was to blame for its financial struggles.

...We cannot keep FEMA, the Military & the First Responders, who have been amazing (under the most difficult circumstances) in P.R. forever!

— Donald J. Trump (@realDonaldTrump) October 12, 2017

His broadsides triggered an outcry from Democrats in Washington and officials on the island, which has been reeling since Hurricane Maria struck three weeks ago, leaving death and destruction in an unparalleled humanitarian crisis.

San Juan Mayor Carmen Yulin Cruz, with whom Trump has had a running war of words, tweeted that the president’s comments were "unbecoming" to a commander in chief and "seem more to come from a ‘Hater in Chief.’"

"Mr. President, you seem to want to disregard the moral imperative that your administration has been unable to fulfill," the mayor said in a statement.

The debate played out as the House headed toward passage of a $36.5 billion disaster aid package, including assistance for Puerto Rico. House Speaker Paul Ryan, R-Wis., said the government needs to ensure that Puerto Rico can "begin to stand on its own two feet" and said the U.S. has "got to do more to help Puerto Rico rebuild its own economy."

Forty-five deaths in Puerto Rico have been blamed on Maria, about 85 percent of Puerto Rico residents still lack electricity and the government says it hopes to have electricity restored completely by March.

Both Trump and Vice President Mike Pence visited the island last week to offer the U.S. commitment to the island’s recovery. But Trump’s tweets on Thursday raised questions about whether the U.S. resolve. He tweeted: "We cannot keep FEMA, the Military & the First Responders, who have been amazing (under the most difficult circumstances) in P.R. forever!"

In a series of tweets, the president added, "electric and all infrastructure was disaster before hurricanes." He blamed Puerto Rico for its looming financial crisis and "a total lack of accountability."

...accountability say the Governor. Electric and all infrastructure was disaster before hurricanes. Congress to decide how much to spend....

— Donald J. Trump (@realDonaldTrump) October 12, 2017

The tweets conflicted with Trump’s past statements on Puerto Rico. During an event last week honoring the heritage of Hispanics, for example, the president said, "We will be there all the time to help Puerto Rico recover, restore, rebuild."

Democrats said Trump’s attacks were "shameful," given that the 3 million-plus U.S. citizens on Puerto Rico are confronting the kind of hardships that would draw howls of outrage if they affected a state. One-third of the island lacks clean running water and just 8 percent of its roads are passable, according to government statistics.

"It is shameful that President Trump is threatening to abandon these Americans when they most need the federal government’s help," said Maryland Rep. Steny Hoyer, the second-ranking House Democrat.

The legislative aid package totals $36.5 billion and sticks close to a White House request. For now, it ignores huge demands from the powerful Florida and Texas delegations, which together pressed for some $40 billion more.

A steady series of disasters could put 2017 on track to rival Hurricane Katrina and other 2005 storms as the most costly set of disasters ever. Katrina required about $110 billion in emergency appropriations.

The bill combines $18.7 billion for the Federal Emergency Management Agency with $16 billion to permit the financially troubled federal flood insurance program pay an influx of Harvey-related claims. An additional $577 million would pay for western firefighting efforts.

Up to $5 billion of the FEMA money could be used to help local governments remain functional as they endure unsustainable cash shortfalls in the aftermath of Maria, which has choked off revenues and strained resources.

Ryan, the House speaker, planned to visit Puerto Rico on Friday. He has promised that the island will get what it needs.

"It’s not easy when you’re used to living in an American way of life, and then somebody tell you that you’re going to be without power for six or eight months," said Resident Commissioner Jenniffer Gonzalez-Colon, who represents Puerto Rico as a nonvoting member of Congress. "It’s not easy when you are continue to suffer — see the suffering of the people without food, without water, and actually living in a humanitarian crisis."

The GOP-run Congress had protracted debates last year on modest requests by former President Barack Obama to combat the Zika virus and help Flint, Michigan, repair its lead-tainted water system. Now, it is moving quickly to take care of this year’s crises, quickly passing a $15.3 billion measure last month and signaling that another installment is coming next month.

Several lawmakers from hurricane-hit states said a third interim aid request is anticipated shortly — with a final, huge hurricane recovery and rebuilding package likely to be acted upon by the end of the year.