The embattled governor of Puerto Rico has resigned after leaked chat messages showed him making homophobic, sexist, and otherwise inappropriate remarks.

Governor Ricardo Rosselló said that he was going to announce his resignation yesterday at 5pm. When he failed to do so, protestors took to the streets again. Just before midnight, he announced his resignation in a Facebook video.

“The demands have been overwhelming and I’ve received them with highest degree of humility,” he said in the video.

He said in the video that he would be stepping down on August 2 to “to allow for an orderly transition” and that he would be succeeded by Secretary of Justice Wanda Vázquez. Vázquez used to be a prosecutor with Puerto Rico’s Office of Women’s Affairs.

Related: Puerto Rico bans conversion therapy while Trump launches latest attack on island’s government

Normally the Secretary of State would replace a resigning governor in Puerto Rico, but Secretary of State Luis Rivera already resigned due to the scandal.

“What I wish most is peace and progress for my people,” Rosselló said, touting his record as governor and ignoring the corruption scandals that plagued his administration.

Two weeks ago the Center for Investigative Journalism released over 800 pages of messages from a group chat administered by Rosselló. In the chat, top officials made numerous offensive comments about political opponents and journalists, calling several “faggot,” “bitch,” and “cocksucker.”

Rosselló himself said a video of a straight politician reached “historic cocksucker levels” and called a journalist an “unprecedented cocksucker” because the tweeted about ferry problems on the island.

Puerto Rico’s chief financial officer Christian Sobrino, who accused pop star Ricky Martin of having turned gay because he was so sexist, said that he was “dying to shoot [San Juan Mayor Carmen Yulín Cruz] up.”

“You’d be doing me a big favor,” Rosselló responded.

The emails led to massive protests in Puerto Rico, where even Ricky Martin marched because he was “tired of the cynicism.”

“Puerto Rico has suffered enough,” Martin said.

The next gubernatorial elections in Puerto Rico are scheduled for November 2020.