The governor of Puerto Rico, Ricardo Rosello has announced that he will resign on August 2 after protesters called for him to step down over a leak of obscene and insulting messages between him and his advisers.

A crowd of demonstrators erupted into cheers and sang outside  Rossello’s mansion in Old San Juan, shortly after he made his announcement on Facebook at around midnight on Wednesday.

“The demands have been overwhelming and I’ve received them with highest degree of humility,” Mr. Rosello said while addressing the protesters.

The messages which were laced with obscenities involved the governor and 11 other men. They infuriated Puerto Ricans who were already angry with the corruption, mismanagement, the economic crisis and the slow recovery from Hurricane Maria.

Participants in the group chat mocked constituents, including hurricane survivors and made offensive remarks about women with Rosello calling one a whore. There were 889 pages of conversations that were leaked on July 13.

The group of men also talked about government contracts. Authorities this week issued search warrants for their mobile phones to determine whether the group divulged confidential government information.

Tens of thousands of people protested and called for Rossello’s resignation in the biggest demonstrations seen in the country since those which brought an end to the United States Navy training on the island of Vieques more than 15 years ago.

 Rossello, a Democrat was elected in 2016 and is the first governor to resign in the US territory’s recent history. More than three million US citizens live in Puerto Rico.

The governor had over the weekend posted a video on Facebook in which he announced that he would not seek re-election in 2020 or continue as the head of his political party.

Under its constitution, Puerto Rico’s Secretary of State would usually assume the governorship but since Secretary of State, Luis Rivera Marin became one of more than a dozen officials to resign over the leak, leadership of the island falls on Justice Secretary, Wanda Vazquez.

Vasquez will become Puerto Rico’s second woman governor.