The French supreme court has annulled last April's election of New Caledonia's Congress president, Roch Wamytan.
The court in Paris upheld a complaint by the Caledonia Together Party leader Philippe Gomes, who claimed that the process of choosing Mr Wamytan was in breach of the rules.
In a sitting which two parties boycotted after deeming it to be illegal, Mr Wamytan was chosen by 32 of the 35 members present.
A majority, however, decided to ignore the official closure of the session by the Congress vice-president and proceeded with Mr Wamytan's election.
Mr Gomes and his supporters had left the sitting after bringing down the collegial government for a third time in four weeks amid a yet unresolved dispute over which flag the territory should adopt as part of its decolonisation process.
Last month, the French legislature changed New Caledonia's electoral law to stop serial resignations, by guaranteeing any new government an 18-month grace period.