Pierluisi@ (Adds Vazquez's swearing in as governor, Pierluisi statement)
SAN JUAN, Aug 7 (Reuters) - Puerto Rico got its third governor in less than a week on Wednesday just hours after the bankrupt U.S. territory's supreme court ruled that Pedro Pierluisi's assumption of the office was unconstitutional and ordered him to leave.
The island's justice secretary, Wanda Vazquez, was sworn in as governor at the supreme court in San Juan.
A unanimous decision by the nine-member high court nullified Pierluisi's governorship based on the fact his earlier appointment as secretary of state and next in line for governor had not been confirmed by both chambers of the legislature.
Pierluisi, who was given until 5 p.m. local time (2100 GMT) by the court to vacate the office, said he "must step aside and support" Vazquez.
"This is a time when we must all unite for Puerto Rico, leaving behind any partisan, ideological or personal agendas," he said in a statement.
Vazquez last week initially expressed an unwillingness to take over the island's top government post after being targeted by protesters for being too close to disgraced Governor Ricardo Rossello, who left office last Friday.
In a statement following the court ruling, Vazquez said: "Puerto Rico needs certainty and stability."
The high court's ruling followed weeks of political turmoil with Rossello resigning after of days of protests demanding he step down.
Offensive chat messages between Rossello and his closest allies and federal corruption charges against two former members of his administration sparked the protests, which drew around a third of the island's 3.2 million people to the streets. (Reporting by Luis Valentin Ortiz in San Juan Additional reporting by Karen Pierog in Chicago Editing by Matthew Lewis)