The Solomon Islands parliament has elected Manasseh Sogavare as the new prime minister.
Mr Sogavare defeated his only rival for the top post, Fred Fono, by 28 votes to 22.
The vote comes eight days after Snyder Rini resigned as prime minister.
He stepped down after Mr Sogavare and some of his supporters defected to the opposition camp.
Mr Rini's election just over two weeks ago had triggered riots in parts of the capital, Honiara, and led to the arrest of two MPs on charges of inciting the unrest.
A government advisor, Johnson Honimae, says despite being in remand, the two were allowed to vote.
"Both members of parliament, the Honourable Charles Dausabea and Nelson Ne'e voted. Their ballot papers were taken to them where they are in police custody and the papers were taken back into parliament."
Mr Sogavare, who leads the Social Credit Party, was the commerce minister in Mr Rini's short-lived administration and held the prime ministership for just over a year after the 2000 coup ousted the government of Bartholomew Ulufaalu.
Mr Sogavare has indicated that he will switch diplomatic ties from Taiwan to China in contradiction to his pre-election policy.