Moetai Brotherson of the pro-independence Tavini Huitraatira has been elected president of French Polynesia for a five-year term.
In the election in the territorial assembly, Brotherson received 38 votes, defeating Edouard Fritch of the Tapura Huiraatira, who obtained 16 votes.
Nicole Sanquer of A Here Ia Porinetia, who was the first woman to seek the presidency, got three votes.
A fourth candidate Benoit Kautai, a Tapura member from the Marquesas Islands, withdrew his bid minutes before the vote.
Brotherson's election follows last month's territorial elections in which the Tavini won 38 of the 57 assembly seats.
He is the second Tavini politician to win the presidency after Oscar Temaru in 2004, who however remains the party leader.
In his address, Brotherson has called for respect for the institutions and in relations with France.
He said he will travel to Paris in June for talks with the French government.
Brotherson is expected to present his government at the beginning of next week but before the presidential election he said he would form a ten-member government made up of mainly women.
In his speech to the assembly, Fritch praised the territory's achievements under the autonomy statute and warned the incoming government against 'biting the hand that feeds you'.
Fritch, who was president for the last nine years, has told Tahiti Nui TV that independence for Pacific Island countries can be difficult, citing Vanuatu which he says now lives in misery.