MIAMI — A political crisis engulfed Puerto Rico over the weekend, prompting the departure of two senior members of the government and threatening Gov. Ricardo A. Rosselló, who found himself increasingly isolated in office and no longer supported by leaders of his own party.

Mr. Rosselló’s administration was rocked by the publication of a trove of derisive messages sent by the governor and some of his cabinet members and top aides in a private chat on the messaging app Telegram. The messages mocked political foes and allies alike, often with profanity.

On Saturday, the governor tried to contain the fallout of the rapidly unfolding scandal by announcing that his chief financial officer and secretary of state had stepped down over their participation in the chat. But the high-profile exits proved insufficient to quell the widespread furor on the island that mushroomed in the hours after 889 pages of Telegram messages were published by Puerto Rico’s Center for Investigative Journalism.

Protesters gathered outside the governor’s mansion, La Fortaleza, in San Juan late into the night on Saturday and demanded Mr. Rosselló’s resignation, less than 18 months before the end of his term.