SAN JUAN (Reuters) - Puerto Rico Governor Ricardo Rosselló on Wednesday said he would resign after almost two weeks of protests calling for him to step down over a scandal involving offensive chat messages and government corruption that rocked the bankrupt island.

Rosselló said in a televised speech he would stay in his position until Aug. 2 when Puerto Rico Secretary of Justice Wanda Vazquez would take over as governor.

The first-term governor announced his resignation three days after he failed on Sunday to soothe critics’ concerns by vowing not to seek re-election next year and giving up the leadership of his political party.

His term as governor has seen the island hit with back-to-back 2017 hurricanes that killed about 3,000 people and wreaked widespread destruction just months after the U.S. territory filed for bankruptcy.

At-times violent protests have rocked San Juan and its historic colonial capital district since the July 13 release of leaked text messages between Rosselló and his closest allies, with an estimated 500,000 people attending the largest demonstration on Monday.