Ricardo Rossello, the embattled governor of Puerto Rico who was forced to step down amid a political scandal and mass protests, officially resigned as the island’s leader at 5 p.m. Friday, and later in the evening his successor, Pedro Pierluisi was sworn in as the next governor of the island.

Pierluisi was sworn in by a judge at 5 p.m., the hour Rosselló had set to leave office, according to the Associated Press.

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, the AP reported. 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.

The future of the position and who would hold it in the long run remained shrouded in uncertainty right up until the hours leading up to Rossello’s promised resignation.

Pierluisi was sworn in as secretary of state Wednesday, making him next in line of succession -- though he has not been confirmed by Puerto Rico's Senate.

The House of Representatives confirmed his nomination Friday, but the Senate will not hold a vote until Monday afternoon.

Rosselló said confirmation by both houses was unnecessary for a recess appointment, an assertion that appeared certain to generate legal challenges, according to AP.

Several legislators expressed concern over Pierluisi, alleging a conflict of interest because he worked for a law firm that represents a controversial federal control board overseeing the island’s finances.

Wanda Vazquez, the secretary of justice, had been considered a serious contender for the position.

She has been the subject of heavy criticism since it became clear she could hold the title.

Critics have charged that Vazquez has not taken action in investigating corruption involving members of her and Rossello’s party, the New Progressive Party.

Last November, officials from the Office of Government Ethics said they received a complaint about possible ethical violations involving Vazquez, according to the Associated Press. She was accused of intervening in a case in which a suspect was charged with stealing government property at a home where Vázquez's daughter lived, the AP reported.

Vazquez, a former prosecutor, faced multiple charges but a judge in Puerto Rico ultimately determined there was not enough evidence to arrest her.

She had also made it clear she did not want the governor's job.

"I reiterate, I have no interest in occupying the position of Governor," Vasquez wrote in a tweet in Spanish on Sunday. Yet, she tweeted, "The constitution dictates it."

She later clarified that she was ready to take over the governorship if Pierluisi wasn’t confirmed.

The island was thrown into disarray after leaked text messages allegedly showed Rossello and his staff making homophobic, misogynistic and sexist comments against opponents and critics, as well as mocking victims of 2017's Hurricane Maria.

In Rossello's resignation speech, he cited the accomplishments of his administration when it comes to infrastructure, corruption reforms and LGBTQ rights. He also noted the challenges the island faced after Hurricanes Irma and Maria.

"I hope that this decision will serve as a call for citizen reconciliation that we need so much to move forward with the welfare of Puerto Rico as its north," Rossello said. "I complete my mandate and the most I desire is peace and progress."