Puerto Rico Gov. Ricardo Rosselló resigned Friday as promised and his chose successor, Pedro Pierluisi, was sworn in. But the future of Puerto Rico's government is far from certain, with only Puerto Rico's House of Representatives having voted to confirm Pierluisi and the Senate set to vote Monday.

In an emailed announcement from his office, Rosselló said Pierluisi does not need confirmation from both houses of the territory's legislature because he was named secretary of state — the next in line to be governor — in a recess appointment earlier this week. But lawmakers may challenge it in court.

Pierluisi was named secretary of state, the next in line to be governor, in a recess appointment this week. In an emailed announcement from his office, Rosselló said Pierluisi would succeed him. He was sworn in by a judge at 5 p.m., the hour Rosselló had set to leave office.

Get Breaking News Delivered to Your Inbox

Pierluisi said he was "fully capable and authorized to act, but the Senate will have its say."

Depending on the Senate's action, his tenure "could be very short-lived," he said. He did not plan to move into the governor's mansion until after the vote. He also said he would avoid any major changes and concentrate on meeting with top government officials.

The down-to-the-wire maneuvering risked political chaos and sowed bitterness and pessimism among Puerto Ricans about the fate of their island, which has been battered by years by bankruptcy and Hurricane Maria in 2017, one of the worst natural disasters in U.S. history.

Only days ago, there was jubilation over the success of the popular movement to force Rosselló out of office. On Friday, Puerto Ricans bemoaned the confusion that left them not knowing who would be their next governor.

"People are disgusted with the government in general, not just Ricardo Rosselló, everyone," said Janeline Avila, 24, who recently received her degree in biotechnology.

Puerto Ricans celebrated Rosselló's exit on Friday outside the governor's mansion in San Juan.

Rosselló and several other top government officials in Puerto Rico have been embroiled in a group messaging scandal. In leaked messages between Rosselló and his lieutenants, they disparaged a political opponent as a "whore," poked fun at an obese man and joked about feeding a cadaver from the island's backlogged morgue to a critic.

Even before the scandals, many Puerto Ricans had become frustrated by systemic problems on the island, which is still reeling from devastating storms and years of economic weakness.

More than a dozen people resigned in the immediate aftermath of the scandal, including former Secretary of State Luis Rivera Marín. Rosselló insisted he would stay in office, but then conceded he would not seek reelection and announced his resignation on July 24.