This post has been updated.

The allegations against Puerto Rico Gov. Ricardo Rosselló make him look like a villainous politician straight out of a cartoon: He participated in profane chats that made light of dead Hurricane Maria victims, and there are corruption charges against officials in his administration.

Tens of thousands of Puerto Ricans, many of whom are frustrated with life on an island still struggling to recover from a financial crisis and the natural disaster, want him out. And after a week of sustained protests, they won. Rosselló announced late Wednesday that he will resign Aug. 2, under threats of impeachment.

But even as they protested for their governor’s ouster, Puerto Ricans could be the ones most wounded by the scandal. They are left with decimated leadership — the ordinary line of succession has been affected by the scandal — and without a federal government willing to help it recover from the hurricane and decades of mismanagement.

Here’s a primer on what’s going on there.

There’s much more to the story, but let’s start with the private chats.

They are the spark that lighted the fuse. On July 13, the Puerto Rican nonprofit Center for Investigative Journalism published 889 pages of private chats between Rosselló and his officials and aides from last year, conversations conducted over the messaging app Telegram. All men, they made misogynistic jokes, made fun of gay people, insulted journalists, joked about shooting San Juan’s female mayor, made light of Hurricane Maria victims, and joked about the weight of a citizen with whom the governor had posed in a photo.

CNN’s Ray Sanchez did a good job of highlighting and translating some of the most jaw-dropping chats from various officials close to the governor. Such as:

On Hurricane Maria victims: “Now that we are on the subject, don’t we have some cadavers to feed our crows?”

On singer Ricky Martin, who is gay: One chat called him a “male chauvinist” and used vulgar language to say that Martin is gay “because women don’t measure up. Pure patriarchy.” (The chats have been dubbed by some in Puerto Rico as “Chatgate" or “Rickyleaks,” the Associated Press reports. “It’s pretty much barbaric what he’s doing,” Martin told “CBS This Morning.” “We’re tired. We’re angry.”)

On San Juan Mayor Carmen Yulín Cruz: “I am salivating to shoot her.” (“You’d be doing me a grand favor,” the governor replied.)

Thousands started protesting in San Juan, the capital, almost immediately. By last week, an estimated 75,000 people marched in San Juan calling for the governor’s ouster, reported “CBS This Morning.” Some of the protests turned violent during the night.

After the chats leaked, the governor apologized and said by way of explanation that there were days that he and his aides had worked “18 hours” and were tired. But he refused calls to resign, even as members of his own New Progressive Party turned against him in the legislature. An impeachment inquiry found there would be grounds to remove him.

Puerto Rico’s government has been in crisis for a while.

In the town of Yabucoa, residents say the Trump administration let them down and their struggle continues.

A week before the chats were released, the FBI arrested some Rosselló officials, including the education secretary, on charges related to fraud involving $15.5 million in federal funds that prosecutors say went to companies they were friendly with.

Puerto Rico has also declared bankruptcy, with an oversight board installed by the U.S. government now managing the island’s finances.

And the island is still struggling to recover from Maria. About 3,000 people died in the 2017 hurricane, and governments at all levels — including in Washington — have been criticized for their sluggish response. Thousands of people still live under blue tarps rather than roofs, The Washington Post reported.

Congress approved $40 billion in aid after the storm, but Puerto Ricans have lost confidence that they’ll see that money, stuck in a bureaucratic pipeline from Washington to San Juan.

Others involved in the chat, including Puerto Rico’s secretary of state — who would be next in line for the island’s top job — resigned, raising the question of what will happen when Rosselló goes.

Also, hurricane season is starting.

The losers in all this could be the residents of Puerto Rico.

Justice Secretary Wanda Vázquez Garced will be the next governor, although The Post reports she is on the receiving end of criticism for allegations that, as a prosecutor, she wasn’t as swift prosecuting members of her own party as she was for others. She’s up for the job in the wake of the secretary of state’s resignation.

This all coincides with President Trump’s narrative of Puerto Rico. His administration has been accused, including by a majority of Puerto Ricans, of neglecting the U.S. territory’s hurricane recovery while focusing resources on U.S. states hit by hurricanes about the same time.

But he has pointed the finger back at Puerto Rico’s government. He has feuded with San Juan’s mayor, said his administration did a “fantastic job” helping the territory, and now is highlighting this latest controversy — calling the Puerto Rican government “corrupt” in a tweet and incorrectly saying Congress gave $92 billion to the territory.

What’s most worrisome for Puerto Ricans, though, is how Trump said Congress “foolishly” gave Puerto Rico the money, suggesting that the island under Rosselló didn’t deserve substantial aid from the hurricane.

That’s a dangerous thought for many Puerto Ricans. As The Post’s Arelis R. Hernández and Jeff Stein reported, some lawmakers in Congress are considering what they can do to put tighter restrictions on federal funding to Puerto Rico.

As public school teacher Rafael Capo Garcia told Hernández: “I’m worried that people will think Puerto Ricans cannot govern themselves.”