A party formed by a pro-democracy movement has emerged as the biggest winner in Tonga's first popularly-elected parliament.
The Democratic party, led by veteran campaigner Akalisi Pohiva, took 12 of the 17 seats available. The other five went to independents.
However, nine major landowners are entitled to additional seats, making the final result uncertain.
The poll marks a transition away from the 165-year rule of the monarchy.
Four years ago, anger over government heel-dragging in implementing political reforms led to riots in the capital, Nuku'alofa.
Gangs targeted businesses run by ethnic Chinese people. Much of the town centre was burned to the ground and eight people were killed.
Mr Pohiva, whose party fell just short of a majority, said it was time for Tonga to move on.
"I have to forget the past, we have been going through very painful, very painful time."
Mr Pohiva must now consult with the other independent MPs to form a government.
Analysts say Mr Pohiva is likely to become the prime minister after the nine nobles - elected in a separate vote - agreed to appoint a "commoner" to the post.
About 89% of the 42,000 registered voters cast ballots, according to election officials.
King George Tupou V called the election "the greatest and most historic day for our kingdom".
Previously the king has chosen the majority of politicians, the entire cabinet and the prime minister.
This time, the elected parliamentarians will vote for a prime minister.
Tonga suffers high unemployment and a quarter of its population live below the poverty line.
Analysts said it was not yet clear what concrete changes the political shift would bring.