Ricardo Rosselló, the embattled governor of Puerto Rico, has resigned following days of protests on the island and calls from U.S. lawmakers for him to step down.

In a live-streamed message on Wednesday night, Rosselló said his resignation would take effect on Aug. 2 at 5 p.m.

The announcement came shortly after the Puerto Rican legislature all but gave Rosselló an ultimatum—to either step down or face impeachment proceedings. Three attorneys commissioned by Carlos Méndez Núñez, the president of Puerto Rico’s House of Representatives, reportedly unanimously determined five separate offenses to serve as grounds for impeachment, including illicitly using public resources and services for partisan purposes and allowing government officials and contractors to misuse public funds.

Rosselló, already under scrutiny after two members of his administration were hit with corruption charges earlier this month, sparked public outrage after hundreds of pages of messages were leaked last week that showed him using homophobic and misogynist slurs. In some of the messages, Rosselló made homophobic remarks about singer Ricky Martin, and called the former speaker of the New York City Council, Melissa Mark-Viverito, a “whore.” In others, he attacked journalists by discrediting stories and threatened to turn over political opponents to the police.

He apologized in the wake of the leaks but had initially resisted pressure to step down.

“I’m the governor of Puerto Rico, but I’m a human being who has his faults,” he said at a press conference last week, adding that he had simply been venting in the private chats. “None of this justifies the words I’ve written. My apologies to all the people I have offended.”

Some of the largest protests in Puerto Rico’s history broke out on the island following the leak. Hundreds of thousands of people took to the streets of the capital of San Juan, at one point shutting down a major highway and paralyzing much of the city.

Demonstrators launched impromptu line dances, paraded on horseback, banged pots, and carried banners along several miles of highway, The New York Times reported. Many shouted “Ricky, renuncia, el pueblo te repudia!” — “Ricky, resign, the people reject you.” The hashtag #RickyRenuncia also spread on Twitter as calls for Rosselló’s ouster mounted, with Rep. Alexandria Ocasio-Cortez (D-NY) among the U.S. lawmakers to express solidarity with protesters.

“The people of Puerto Rico have spoken loudly and clearly for the world to hear,” Ocasio-Cortez wrote in a tweet. “We must stand with la isla. Rosselló must resign.”

President Donald Trump also said that the Rosselló should resign, calling him a “terrible governor.”

Several 2020 Democratic candidates joined in as well. Former Vice President Joe Biden said Roselló’s comments were shameful, and that “the people of Puerto Rico will be heard, and they will decide who leads their government.” Sen. Bernie Sanders (I-VT) said “Puerto Ricans have the right to democracy and all federal support to get out of the crisis.” Sens. Elizabeth Warren (D-MA) and Kamala Harris (D-CA) also called for Rosselló’s resignation last week.

Rep. Tulsi Gabbard (D-HI) visited demonstrators in San Juan on July 19, saying she wanted to “show support” for protesters demanding Rosselló step down.

“I’m here today to stand with and show support for my fellow Americans in Puerto Rico in their stand against corruption, and against a government that has proven it is of, by and for the rich and powerful, leaving the people behind,” she said in a press release.

Rosselló’s announcement comes shortly after his chief of staff, Ricardo J. Llerandi Cruz, resigned. Cruz also participated in the leaked messages, and wrote in his resignation letter that he decided to “put the welfare of my family under consideration” after receiving threats.