Following weeks of protests from Puerto Ricans demanding his ouster, embattled Gov. Ricardo Rosselló caved late Wednesday, announcing that he will resign on Aug. 2.

The 12th governor of San Juan will become the island’s first leader to resign. Rosselló is stepping down after massive demonstrations rocked the island for two weeks in the biggest protests to seize the U.S. territory in decades. Justice Secretary Wanda Vázquez is set to take over due to the absence of a Secretary of State. Former Secretary of State Luis Rivera Marín resigned on July 13. Rosselló’s announcement comes one day after his chief of staff, Ricardo Llerandi, announced his resignation.

The spiraling political crisis kicked off on July 13 over “Chatgate”, a scandal that involved leaked, obscenity-laden and offensive online chat messages between the governor and several cabinet members.

The leak uncorked years of pent up anger over mismanagement, corruption, recession and poorly-handled natural disaster recovery. Protesters charged into the capital, paralyzed a major highway and descended on the governor’s mansion with their chants of “Ricky, renuncia” — Ricky, resign.

But while government officials around Rosselló stepped down, Rosselló initially remained obstinate. He said he would resign from his party’s leadership and not seek reelection in 2020, but insisted on seeing out his remaining two years in office. Unsatisfied, Puerto Ricans vowed to stay on the streets until they succeeded in forcing him out.

Just before the unrest erupted in Puerto Rico this month, several high-ranking officials were indicted on charges of fraud and money laundering, including Education Secretary Julia Keleher. She and others were accused of directing up to $15.5 million dollars in federal funds toward politically-connected contractors between 2017 and 2019.

And then, Chatgate hit. Transcripts published by the Puerto Rican Center for Investigative Journalism revealed insensitive exchanges where Rosselló and his associates ridiculed fellow politicians and made light of victims of Hurricane Maria. They also shared privileged information, including the island’s budget process and discussed issues of public policy, the Center for Investigative Journalism said.

In one stunning leaked exchange, former Chief Financial Officer Christian Sobrino Vega used the accumulating death toll from Maria as a punchline to a joke about the administration’s critics. When asked about the budget for forensic pathologists he responded, “Now that we are on the subject, don’t we have some cadavers to feed our crows?” He then added, “Clearly they need attention.”

While the corruption and chat leak helped catalyze the protests, Puerto Ricans were already disenchanted with Rosselló after his administration’s handling of Hurricane Maria in 2017.

The Category 5 hurricane caused widespread flooding and blackouts and was made worse by a slow response from the federal government. It also exposed the extent of poverty and inequality rampant on the island.

Rosselló faced scrutiny for his perceived slow and insufficient response, which included not standing up to President Donald Trump and failing to publicly acknowledge the significant impact of the storm. A George Washington University study found took the life of nearly 3,000 citizens. That same study said failures in government institutions contributed to the death rate, especially for poorer Puerto Ricans.

A U.S. territory since 1898, Puerto Rico is home to more than 3 million people. While they are U.S. citizens, they cannot vote in presidential elections and do not have representation in Congress. Almost half of the residents live below the poverty line. When Hurricane Maria struck, Puerto Rico — which was already in a financial crisis — was driven further into debt.

As scandal engulfed Rosselló’s administration this month, he apologized for participating in offensive chats but steadfastly maintained he did not break any laws. And though he had weathered the public’s ire before, ultimately the pressure from these protests became too much.

“The demands have been overwhelming and I’ve received them with highest degree of humility,” Rosselló said in a Facebook post announcing his resignation, according to the Associated Press.

Rosselló, a 40-year-old biomedical engineer who received his Ph.D. from the University of Michigan, assumed office on January 2, 2017. He is the son of former Puerto Rican Governor Pedro Rosselló and the leader of the New Progressive Party. Rosselló makes history as the first governor in Puerto Rican history to resign.

Write to Gina Martinez at gina.martinez@time.com.