President Trump served notice Thursday that he may withdraw federal relief workers from Puerto Rico and blamed the island for its failing infrastructure, effectively threatening to abandon the U.S. territory amid a staggering humanitarian crisis in the aftermath of twin hurricanes.

Under withering criticism from Puerto Ricans for his administration's flawed response to the devastation there, Trump sought to hold the territory responsible for its own plight because of chronic mismanagement — prompting an immediate backlash from Puerto Ricans and mainland lawmakers in both parties.

More than a month after Hurricane Irma swept ashore and three weeks after Hurricane ­Maria delivered a crushing blow, much of Puerto Rico remains without power, and many of its 3.4 million residents still are struggling to find clean water, hospitals are short on medicine, commerce is slow, and basic services are unavailable.

In a trio of Thursday morning tweets, Trump declared, "Electric and all infrastructure [in Puerto Rico] was disaster before hurricanes." He said it would be up to Congress how much federal money to appropriate for recovery efforts there — and, in an extraordinary statement by an American president, warned that relief workers would not stay "forever."

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

And he quoted Sharyl Attkisson, a television journalist with Sinclair Broadcasting Group, as saying, "Puerto Rico survived the Hurricanes, now a financial crisis looms largely of their own making."

Critics contrasted Trump's comments about Puerto Rico and its leaders — during a visit there last week, he complained that the recovery had "thrown our budget a little out of whack" — with the empathy he showed after storms ravaged Texas, Louisiana and Florida.

[Three weeks since Hurricane Maria, much of Puerto Rico still dark, thirsty and frustrated]

On the island, residents and elected officials responded to Trump's Thursday tweets with outrage and disbelief. Radio disc jockeys gasped as they read aloud the presidential statements, while political leaders charged that he lacked empathy and pleaded for help from fellow U.S. citizens on the mainland.

"The U.S. citizens in Puerto Rico are requesting the support that any of our fellow citizens would receive across our Nation," Puerto Rico Gov. Ricardo Rosselló, who has publicly praised Trump's handling of the crisis, tweeted in apparent response to the president.

Carmen Yulín Cruz, the mayor of Puerto Rico's capital, San Juan, who has been feuding publicly with Trump, strongly condemned the president's tweets. In a tweet of her own, she derided him as a "Hater in Chief." And she said in a statement that he "is simply incapable of understanding the contributions, the sacrifices and the commitment to democratic values that Puerto Ricans have shown over decades."

1 of 70 Full Screen Autoplay Close Skip Ad × Puerto Rico devastated in the aftermath of Hurricane Maria View Photos After the Category 4 hurricane slammed into Puerto Rico, many of the more than 3.4 million U.S. citizens in the territory were still without, adequate food, water, electricity and fuel. Flights off the island were infrequent, communications were spotty and roads were clogged with debris. Caption After the Category 4 hurricane slammed into Puerto Rico, many of the more than 3.4 million U.S. citizens in the territory were still without, adequate food, water, electricity and fuel. Flights off the island were infrequent, communications were spotty and roads were clogged with debris. Carlos Barria Buy Photo Wait 1 second to continue.

Trump has been roundly criticized for his seeming reluctance to come to Puerto Rico's aid. During last week's visit to San Juan, the president tossed rolls of paper towels at residents as if shooting baskets. He also noted that the death toll was lower than the "real catastrophe" of 2005's Hurricane Katrina.

To many Puerto Ricans, Trump's Thursday comments stung and helped underscore their feeling that the president does not view them as deserving the same level of assistance as mainland U.S. citizens.

"We are the same kind of citizens as those in Texas and New York," Joan Figueroa, a 44-year-old homemaker, said as she waited for several servings of rice to take to bedridden elderly neighbors in her apartment complex on the edge of San Juan.

"He wouldn't say what he's said if the disaster was there," Figueroa said. "We depend on the federal government because our government can't handle it. But we will rise up with or without Trump."

On a bus headed for the crowded and sweltering San Juan airport, Isabel Cruz and Ramon Nieves — a married couple who lived much of their adult lives in New Jersey but retired in Puerto Rico, the island of their births — sat in a middle row rattling off several of Trump's tweets almost word for word in voices that dripped with disdain.

"He doesn't think of us as Americans," said Nieves, 71.

"It's not just that," Cruz, 78, said. "He's racist."

That last word, "racist," she said slowly and emphatically. Then she repeated it for emphasis.

[Trump’s tweets anger but do not surprise Puerto Ricans]

In Washington, Trump administration officials sought Thursday to reassure Puerto Ricans that the U.S. government remained fully committed to the territory's long-term recovery, despite the president's tweets.

Standing beside Trump at a White House event in which she was formally nominated to be secretary of homeland security, Kirstjen Nielsen addressed long-term hurricane recovery efforts.

"I also know that this rebuilding will take years, and I want to echo what the president has said many times: We will remain fully engaged in the long recovery effort ahead of us," said Nielsen, currently the deputy White House chief of staff.

John F. Kelly, the White House chief of staff, similarly told reporters that "our country will stand with those American citizens in Puerto Rico until the job is done." Asked whether Trump considers Puerto Ricans to be U.S. citizens, Kelly said he did.

Kelly, who said he spoke with Rosselló earlier in the day, said Trump's tweets were meant to communicate his hope that Federal Emergency Management Agency workers and the military could withdraw and hand off efforts to the Puerto Rican government "sooner rather than later."

"They're not going to be there forever," Kelly said. "The whole point is to start to work yourself out of a job, and then transition to the rebuilding process."

John Rabin, a top FEMA official involved in the response to Hurricane Maria, said in an interview that "as Puerto Rico needs assistance from the federal government, we're there to provide it."

"Everybody that's working in FEMA, everybody that's there in Puerto Rico, is focused on helping Puerto Rico respond and recover, and that's what we're going to focus on," said Rabin, the acting regional administrator for FEMA Region 2, which oversees Puerto Rico, the U.S. Virgin Islands and New York and New Jersey.

Federal recovery and rebuilding efforts from past storms — such as Hurricane Katrina, which devastated New Orleans and surrounding areas in 2005 — have lasted months and in some cases years.

But White House press secretary Sarah Huckabee Sanders said, "Successful recoveries do not last forever; they should be as swift as possible to help people resume their normal lives."

Trump's threats to limit the emergency-worker footprint in Puerto Rico come as the House voted Thursday by an overwhelming margin, 353 to 69, to pass a $36.5 billion disaster aid package that includes provisions to avert a potential cash crisis in Puerto Rico prompted by Maria. The Senate is expected to take up the measure next week.

Rosselló warned congressional leaders over the weekend that the U.S. territory is "on the brink of a massive liquidity crisis that will intensify in the immediate future." The legislation that passed the House allows up to $4.9 billion in direct loans to local governments in a bid to ease Puerto Rico's financial crunch. Without congressional action, the territory may not be able to make its payroll or pay vendors by the end of the month.

[Trump’s Puerto Rico video tells positive story but leaves a lot on cutting-room floor]

House Speaker Paul D. Ryan (R-Wis.) said that Puerto Rico must eventually "stand on its own two feet." But, he said, "at the moment there is a humanitarian crisis that has to be attended to, and this is an area where the federal government has a responsibility, and we're acting on it."

Top Democrats assailed Trump for his Thursday tweets on Puerto Rico. House Minority Leader Nancy Pelosi (D-Calif.) called them "heartbreaking," adding that "we are all Americans, and we owe them what they need."

Senate Minority Leader Charles E. Schumer (D-N.Y.) tweeted: "There is still devastation, Americans are still dying. FEMA needs to stay until the job is done."

Another New York Democrat, Rep. Nydia M. Velázquez, who was born in Puerto Rico, said in a statement that the president's "most solemn duty is to protect the safety and the security of the American people. By suggesting he might abdicate this responsibility for our fellow citizens in Puerto Rico, Mr. Trump has called into question his ability to lead."

On Thursday morning in San Juan, Jose Vazquez was listening to the radio when the programming was interrupted by a special report. An exasperated announcer read Trump's tweets about emergency workers not being in Puerto Rico "forever."

The other disc jockeys gasped in disbelief. Vazquez couldn't believe it either, he said — and paused.

Well, actually, he could.

"We don't want them here forever," Vazquez, 35, said. "We need them until Puerto Rico normalizes. If they can leave soon, great. That would mean we are closer to a full recovery."

But Vazquez, who was waiting outside the Puerto Rico coli­seum to pick up free meals to deliver to elderly public housing residents, said: "FEMA is not a gift. It's insurance we pay for.

"It's their duty to respond," he said. "And we really need the help."

Rucker reported from Washington, and Hernández and Roig-Franzia reported from San Juan, Puerto Rico. Ed O'Keefe, Joel Achenbach and Mike DeBonis in Washington contributed to this report.