Puerto Rico has a new governor -- again.

Wanda Vazquez, the island's justice secretary, became governor Wednesday after she was sworn in by the Supreme Court.

In a late night video address to the island, Vazquez looked bring stability after weeks of unrest.

“We have all experienced the anxiety that causes instability and uncertainty. ... I assume the position of governor, with the certainty that history has brought me here without any political aspiration," she said.

Vazquez called on her public school education and lifetime of work on the island to draw a connection with residents who have seen politicians as out of touch with everyday issues.

"It is necessary to give stability to the country, certainty to the markets and secure reconstruction funds," Vazquez said.

Hours earlier, the court ruled that the swearing in process by which Pedro Pierluisi became governor was unconstitutional.

Vazquez, who will become Puerto Rico's third governor in a week, had previously said that she did not have any interest in becoming to the U.S. territory's chief executive.

But on Wednesday, she released a statement recognizing the decision from the Supreme Court and saying she would accept the role of governor.

"Puerto Rico needs certainty and stability. Our actions will be aimed at that end and will always be first," Vazquez wrote.

Puerto Rico was thrown into disarray after leaked text messages allegedly showed former Gov. Ricardo Rossello and his staff making homophobic, misogynistic and sexist comments against opponents and critics, as well as mocking victims of 2017's Hurricane Maria. Widespread protests followed, prompting the governor to initially say he'd step down after his term in 2020, before resigning almost immediately.

On Wednesday, the island's highest court ruled in a unanimous decision that the part of the law of succession allowing the secretary of state to become governor -- without the confirmation of both legislative chambers -- was unconstitutional.

The interpretation of the succession law was the grounds by which Pierluisi became governor on Aug. 2 after being appointed by Rossello.

Rossello appointed Pierluisi as secretary of state just minutes before leaving the governor's office. Due to a loop hole in the succession laws, Pierluisi was able to be sworn into that role and quickly as governor because the legislative bodies were not in session to review his nomination.

The law of succession as a whole was upheld by the courts.

The court's decision said Pierluisi had until Wednesday at 5 p.m. to leave office. Ahead of the decision, Pierluisi said that he would step aside and allow Vazquez to become governor if the courts decided in that manner.

The suit questioning the legitimacy of Pierluisi's governorship was brought by the island's Senate after he took the position after only having the confirmation from the House of Representatives.

Before stepping down as governor, Pierluisi released a video message, saying: "When I took office as governor this past Friday, I did so on the basis of the express language of the Constitution of Puerto Rico ... I want to be clear that the only motivation I have had during this time, as always, has been the well-being of Puerto Rico."

Pierluisi also wished Vazquez well in her new role.

"This is a time for unity of purpose for the benefit of Puerto Rico, until our people have the opportunity to choose their future leaders in next year's elections," he said.