Puerto Rico Governor Ricardo Rosselló announced late Wednesday that he would resign, lifting a cloud of uncertainty over the U.S. territory and bowing to immense pressure from residents and other politicians amid a widening corruption scandal. He said his resignation would take effect on August 2 and that Secretary of Justice Wanda Vázquez would succeed him.

Rosselló announced his move after federal authorities carried out anti-corruption raids targeting his associates and private messages leaked to the media revealed him and his lieutenants disparaging a political opponent as a "whore," poking fun at an obese man and joking about feeding a cadaver from the island's backlogged morgue to a critic.

Even before the scandals, many Puerto Ricans had become frustrated by systemic problems on the island, which is still reeling from devastating storms and years of economic weakness.

Get Breaking News Delivered to Your Inbox Click here to view related media. click to expand

Rosselló addressed the island Wednesday night in a Facebook Live video.

"My only priority has been the transformation of our island and the well-being of our people," said Rosselló. "The demands have been overwhelming and I've received them with highest degree of humility."

This was the moment thousands of protesters, standing in front of the governors mansion, tonight, heard the governor say he is resigning pic.twitter.com/PhmVDGpe4A — David Begnaud (@DavidBegnaud) July 25, 2019

Thousands protested outside the governor's mansion in San Juan Wednesday night — the 12th night of mass demonstrations. As CBS News' David Begnaud reports, the protesters erupted in cheers after Rosselló's announcement. Dozens of police and corrections officers, some decked out in riot gear, were on the scene to maintain control.

Earlier this week, Rosselló relinquished his role as president of one of the two main political parties in Puerto Rico and vowed not to seek reelection in 2020. But that was not enough for many Puerto Ricans. On Monday, hundreds of thousands paralyzed the capital, marching to call for the governor's immediate resignation.

The crowds employed creative forms of dissent, including demonstrations on horseback and jet skis, and they were often joined by high-profile Puerto Rican celebrities including Ricky Martin and reggaeton artist Bad Bunny. Their calls for Rosselló's resignation received the backing of many members of Congress, the island's non-voting delegate in the House of Representatives and several of the two-dozen Democrats running for president.

Over the course of a few days, Rosselló had became increasingly isolated, even struggling during an appearance Monday on Fox News to name a political leader who backed his bid to remain in power. Last week, when pressed by CBS News, he failed to detail the support he had on the island.

During some of the protests, people chanted "Ricky resign and bring the board with you!" referring to the fiscal oversight board established by Congress to manage the island's ballooning debt. Since its inception, Puerto Ricans have denounced the austerity measures imposed by the board — which they note is comprised of un-elected officials appointed by the White House.

Protesters have also called for long-term reforms to ensure accountability and transparency in Puerto Rico, where governments have faced allegations of corruption and mismanagement for decades.

The island, acquired by the U.S. from Spain during the Spanish-American War in the late 19th century, still has not fully recovered from the devastation caused by hurricanes Maria and Irma in 2017. According to figures accepted by the Puerto Rican government, about 3,000 people were killed as a result of María and the island incurred about $90 billion in damage.

About 30,000 damaged houses on the island still have blue tarps for roofs. The electrical grid, which was destroyed by María, is now operational but remains fragile. The morgue in San Juan — the only one on the island — continues to face a backlog of bodies.

David Begnaud, Camilo Montoya-Galvez and Caroline Linton contributed reporting.