The French South Pacific territory of New Caledonia narrowly rejected independence in a referendum on Sunday, the archipelago's high commission said after a partial count of the votes.
The vote rejecting a breakaway from France after almost 170 years fell to 53.3 percent, according to 70 percent of ballots counted, down from 56.7 percent in a previous referendum two years ago, it said.
Turnout was much higher than last time, reflecting enthusiasm of voters who had formed long queues to cast their ballots.
Sunday's referendum was part of a carefully negotiated decolonisation plan agreed in 1998 which ended a deadly conflict between the mostly pro-independence indigenous Kanak population and the descendants of European settlers.
That violence culminated in a bloody, drawn-out hostage crisis in 1988 that saw 19 separatists killed, along with six police and special forces personnel.
Another chance by 2022
Another referendum can be held by 2022 so long as the poll is requested by at least a third of the local legislature.
Most political observers had forecast a win for the no-vote as well as a narrower margin.
The prospect of a tight race brought voters out in droves, patiently awaiting their turns at polling stations. Turnout was estimated at 85.5 percent.
"I waited 45 minutes. It's very important for me to vote," said retiree Germaine Le Demezet in the capital Noumea.
"I have children and grandchildren here, the future needs to be clear and we need to know what's going to happen to us."
New Caledonia has taken strict measures to keep coronavirus out of the territory, and with case numbers low, the referendum took place without masks and other measures.
New Caledonia, situated between Australia and Fiji and sometimes called "The Pebble", was seized by France in 1853 and is home to 270,000 people.
The economy's mainstays are the production of metals, especially nickel of which New Caledonia is a major global producer, as well as tourism and financial support from mainland France.
The French government, from more than 16,000 kilometres (10,000 miles) away, subsidises the territory with around 1.5 billion euros ($1.75 billion) every year, the equivalent of more than 15 percent of New Caledonia's gross domestic product.
A special authorisation allowing the French national flag to be used in campaign spots angered the pro-independence Kanak and Socialist National Liberation Front (FLNKS), which accused Paris of taking sides against independence.
The last former colonies to gain independence from France were Djibouti in 1977 and Vanuatu in 1980.
French Prime Minister Jean Castex said in the run-up to the poll that he planned to talk to all the main actors after the referendum.