Independence hero Xanana Gusmao has been chosen as East Timor's new prime minister by President Jose Ramos-Horta.
Several fires were started in the capital Dili
But Mr Gusmao's main rival, Fretilin party leader Mari Alkatiri, denounced the decision as illegal.
Youths in the capital Dili threw rocks and set a government building on fire in protest at the decision.
Mr Ramos-Horta wanted the two sides to choose a PM themselves, after a June poll prove inconclusive; but when they failed to agree, he decided himself.
Weeks of deadlock
June's election had been seen as a fresh start for the young, impoverished nation, but neither Fretilin nor the CNRT party led by Mr Gusmao - who was East Timor's president until May 2007 - were able to achieve an overall majority.
Fretilin, under Mr Alkatiri, won 21 seats in the election, while Mr Gusmao's new National Congress for the Reconstruction of East Timor (CNRT) party won only 18 seats.
Fretilin argued that it should form the government because it won most votes, but then the CNRT party formed an alliance with smaller parties, giving it 37 seats in the 65-member legislature.
Former guerrilla leader who led East Timor to independence
Spent six years in Indonesian prison
Made first post-independence president
Stepped down in early 2007 to run for more hands-on role of PM
Weeks of wrangling ensued, but to little effect.
Mr Ramos-Horta delayed carrying out his right to settle the matter until Monday, having repeatedly urged the two parties to agree to a unity government.
But finally he felt he had little choice.
"I have taken the decision to invite the Alliance of the Parliament Majority to form the government," Mr Ramos-Horta told reporters, referring to Mr Gusmao's coalition.
"The AMP has proposed that leader Xanana Gusmao become the prime minister. I have accepted it," he said.
The BBC's Lucy Williamson, in Jakarta, says that though Mr Ramos-Horta's decision risked a violent reaction from Fretilin supporters, he may have decided that allowing the country to stagnate under a minority government would be an even bigger risk to stability.
Risk to stability
Mr Alkatiri was quick to voice his anger at the decision.
"We regard it as a political and illegal decision," he said. "That is why, the government... will never have the co-operation of Fretilin - because this is an illegal government."
But Mr Ramos-Horta urged Fretilin supporters not to turn to violence.
"Do not think that Fretilin has lost. Fretilin is a very important party at the parliament which will become the best opposition because it has experience and the capacity for that," he told reporters.
"I appeal to youths and the public to be calm and give the chance to Brother Xanana to govern," he added.
But youths have already taken to the streets, throwing rocks and burning tyres.
A tax office was set alight before security forces moved in to disperse the crowds with tear gas, correspondents said.
The violence triggered fears of an end to the fragile peace that has held since mid-2006, when violent feuding between rival army and police units spilled out on to the streets.
More than 30 people were killed and thousands were forced to flee their homes in the 2006 unrest.
The clashes eventually led to the resignation of Mari Alkatiri, who was then prime minister.
The former Portuguese colony of East Timor broke away from 25 years of Indonesian rule in a 1999 referendum, and was placed under UN protection until 2002.