SAN JUAN (Reuters) - Puerto Rico Governor Ricardo Rossello said on Tuesday he will stay in office despite protests calling for his resignation that turned violent overnight.

A peaceful demonstration that drew thousands to the streets of San Juan on Monday turned hostile in the evening when protesters and police clashed, injuring 21 law enforcement agents, officials said. The unrest was cited by a cruise ship company for its decision to cancel a scheduled stop by one of its vessels in the island’s capital city.

The political turmoil comes at a critical stage in the U.S. commonwealth’s historic bankruptcy and as its officials seek billions of dollars in funding from the federal government for healthcare and for recovery efforts following devastating hurricanes in 2017.

Protests against Rossello were sparked by leaked controversial and vulgar text messages between the governor and his closest allies and by a federal probe into government corruption on the island.

The Trump administration, which has tangled with Rossello in the past, said the events “prove the president’s concerns about mismanagement, politicization, and corruption have been valid,” according to a statement by White House spokesman Judd Deere.

Rossello, who took office in 2017, said he respected the right to protest peacefully and vowed to bring greater transparency and accountability to his government.

“My commitment is to keep on working and to make sure that services and the transformations that we’ve embarked in Puerto Rico continue,” the governor told a news conference.

Slideshow ( 10 images )

He added he is in the process of replacing Christian Sobrino, the island’s chief financial officer and Rossello’s representative on Puerto Rico’s federally created financial oversight board, and Secretary of State Luis Rivera Martin, the government’s second in command.

The two men, who had participated in the governor’s group chat, resigned on Saturday following the release by Puerto Rico journalist group Centro de Periodismo Investigativo of 889 pages of text messages, showing how Rossello and his closest advisers exchanged memes, comments that were derogatory, misogynistic and homophobic, as well as privileged information in a Telegram group chat.

Rossello said on Tuesday he did not commit anything that could be considered illegal or unethical in the chat, but rather “improper” acts.

The protests were also sparked by U.S. authorities’ announcement of a federal indictment involving six people, including two former high-ranking Puerto Rico government officials, charged with conspiracy and other crimes in connection with millions of dollars in federal Medicaid and education funds.

Rossello said he welcomed greater federal oversight tied to federal dollars as long as it does not slow down the process.

“That should not be a cover for delaying federal funding,” he said.

Meanwhile, a spokesman for Royal Caribbean Cruises Ltd said its Empress of the Seas ship was rerouted on Tuesday to Tortola in the British Virgin Islands “in light of current unrest in San Juan.”

Puerto Rico filed a form of bankruptcy in 2017 to restructure about $120 billion of debt and pension obligations. Its oversight board is expected to soon unveil a proposed plan of adjustment for the island’s core government debt.