Puerto Rico Gov. Ricardo Rossello resigned Friday as promised, clearing the way for veteran politician Pedro Pierluisi to be sworn in as his replacement, a move that threw the U.S. territory into a period of political uncertainty.

Rossello had promised to step down in response to weeks of popular protest over mismanagement and a series of leaked chats in which he and advisers denigrated a range of Puerto Ricans. Because of problems with the qualifications of members of Rossello's administration in the constitutional line of succession, it was unclear until the last minute who would become governor.

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, Rossello said Pierluisi would succeed him. He was sworn in by a judge at 5 p.m. local time, the hour Rossello had set to leave office.

The territory's House of Representatives confirmed Pierluisi as secretary of state Friday, but the Senate has not yet voted on his appointment. Rossello said confirmation by both houses was unnecessary for a recess appointment, an assertion that appeared certain to generate legal challenges.

Two hours after taking the oath, Pierluisi emerged at the governor's residence to address the press and said he would only promise to serve as governor until Wednesday, when the Senate has called a hearing on his nomination. If the Senate votes no, Pierluisi said, he will step down and hand the governorship to the justice secretary, the next in line under the constitution.

Nothing more was heard from Rossello.

Pedro Pierluisi arrives to his confirmation hearing at the House of Representatives in San Juan, Puerto Rico, on Friday. (Dennis M. Rivera Pichardo/The Associated Press)

The down-to-the-wire manoeuvring risked political chaos and a constitutional crisis and sowed bitterness and pessimism among Puerto Ricans about the fate of their island, which has been battered by years of 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 Rossello out of office. On Friday, Puerto Ricans bemoaned the chaos that left them not knowing who would be their next governor.

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

Senate President Thomas Rivera Schatz, a member of Rossello's party seen as a possible future governor, criticized Rossello for naming Pierluisi and appeared to hint at fighting the succession plan.

"He never regretted anything," Schatz said of Rossello. "He did not respect the demands of the people. In fact, he mocked them, using new accomplices."

Schatz said that order and morals will prevail: "No one should lose faith."

Hundreds of protesters marched to the governor's residence, banging pots and drums and singing the national anthem. Protesters had not been highly critical of Pierluisi before Friday but expressed disgust with the succession process and Pierluisi's ties to the federal control board that has promoted cutbacks on the island.

Bryan Carhu Castro Vega, a 21-year-old university student, said he was disappointed.

Listen: Rossello's out, but protestors want more change

Protesters got their wish when Puerto Rican governor Ricardo Rossello stepped down Friday, but he's left behind a political crisis over who should lead the territory and where the it should go from here. 8:10

"It's obvious that the constitutional setup that we have isn't working for the people," he said. "None of the options is one the people chose or want or deserve."

Rosa Cifrian, a 47-year-old professor of nursing, said Pierluisi would not be a good governor "for the people."

"He'll keep promoting policies of austerity, cutbacks, everything that the board says," she said.

Puerto Rico's House of Representatives voted 26-21 — with one abstention — to confirm Pierluisi as secretary of state. The legislature, which is controlled by Pierluisi's New Progressive Party, erupted into cheers when the deciding vote was cast.

Legal questions

Some lawmakers and officials believe that because the legislature was not in session when Pierluisi was appointed, he was already secretary of state. Others argue that he still needs to be confirmed by the House or both the House and Senate.

One constitutional amendment states that everyone in line to become governor has to be confirmed by both House and Senate, except for the secretary of state.

Constitutional law professor Carlos Ramos and other legal experts questioned the validity of that amendment and believed Pierluisi must be confirmed by the House and Senate because the amendment contradicts the intent of the constitution and its statement of motives.

Lawmakers and Pierluisi himself expressed concern that the continuing political uncertainty would damage Puerto Rico's efforts to get federal funds to recover from the hurricane and confront the economic crisis.

Several legislators have accused Pierluisi of a conflict of interest because he worked for a law firm that represents a federal control board overseeing the island's finances, a body that has repeatedly clashed with local officials over demands for austerity measures.

Pierluisi, whose brother-in-law is the board's chairman, tried to dispel those concerns in his opening remarks.

"Who better than me to advocate for our people before the board? Who better than me to facilitate the process that will force the board to leave? That is what we all want," he said.

Demonstrators are seen in San Juan on Friday. (Gabriella N. Baez/Reuters)

The board was created by Congress to oversee the restructuring of more than $70 billion US in public debt after Puerto Rico declared a form of bankruptcy.

Pierluisi told lawmakers he is against several austerity measures demanded by the board, including laying off public employees and eliminating a Christmas bonus.

He said he supports public-private partnerships and the privatization of the island's public power company.

"The people want a change, and I don't blame them," he said.