Voters in the French Pacific territory of New Caledonia have rejected a bid for independence.
Final results showed that 56.4 per cent chose to remain part of France while 43.6 per cent voted to leave - a tighter result than some polls had predicted.
Turnout was about 81 per cent. The vote was promised in a 1988 deal that put an end to a violent campaign for independence.
President Emmanuel Macron said it showed "confidence in the French republic".
"I have to tell you how proud I am that we have finally passed this historic step together," he added.
The referendum passed peacefully but some unrest was reported after polls closed.
Cars and a shop were set ablaze in the capital, Nouméa, local media reported, and the high commissioner's office said some roads were closed by protesters.
New Caledonia has large deposits of nickel, a vital component in manufacturing electronics, and is seen by France as a strategic political and economic asset in the region, reports the BBC.
It is one of the UN's 17 "non-self governing territories" - where the process of decolonisation has not been completed.
About 175,000 people were eligible to vote in Sunday's referendum New Caledonia, east of Australia, where indigenous Kanaks make up 39.1 per cent of the population.
French nationalism is strong among the territory's ethnic Europeans - constituting 27.1 per cent of the population - and observers say even some Kanaks back staying part of France.
The remaining third of the population of New Caledonia's 268,000 inhabitants are also largely said to oppose independence.
The remote islands receive about €1.3bn (£1.1bn; $1.5bn) from the French government every year.
During a visit to Nouméa in May, Macron said that France would be "less beautiful without New Caledonia".
France first claimed the islands in 1853 and once used them as a penal colony.
In the 1980s there were deadly clashes between French forces and Kanaks.
The climax of that conflict came when Kanak separatists killed four French gendarmes and took another 23 hostage in a cave. The subsequent French assault cost the lives of 19 Kanaks and two soldiers.
In 1988 representatives from the both pro- and anti-independence camps agreed to end the violence and eventually hold a self-determination referendum.
A No vote may not spell the end of the independence drive. Two further referendums on independence can still be held before 2022.
A Yes vote would have made New Caledonia the first French territory to break away since Djibouti (1977) and Vanuatu (1980).
New Caledonia is represented in the French parliament by two deputies and two senators.
It has a congress which elects an executive with powers over some policy areas - notably policing, education and local laws.