Romania's top court has ruled that a referendum on the impeachment of President Traian Basescu was invalid, because turnout failed to reach 50%.
The decision thwarts efforts by Prime Minister Victor Ponta to oust Mr Basescu, a bitter rival.
It means Mr Basescu, who was suspended from his post pending the referendum, can now return to the presidency.
In the 29 July referendum, more than 87% voted for impeachment - but only 46% of registered voters took part.
The rivalry between the Mr Ponta and Mr Basescu reached a stand-off after the former accused the president of obstructing government policies and starting a witch hunt against politicians from rival political parties.
But, ahead of the Constitutional Court's verdict on Tuesday, Mr Ponta said: "If six (judges) decide to declare the referendum invalid... then Basescu returns to his post."
The chief judge of the court, Augustin Zegrean, confirmed that the ruling against the referendum was passed "with a legal majority of 6-3".
Romania's acting president and co-leader of Mr Ponta's ruling alliance, Crin Antonescu, promised to abide by the court ruling.
"I took note of the court decision and as previously announced, we will obey the decision," he said.
A former oil tanker captain, Mr Basescu, who has been president since 2004, has accused the centre-left coalition led by Mr Ponta of trying to take over control of independent institutions in Romania.
The centre-right president's popularity has fallen since he introduced a programme of wage cuts and tax increases as part of two deals with the International Monetary Fund in 2009 and 2011.