Unrest in East Timor has highlighted tensions that have been simmering since it became the world's newest nation, writes Jonathan Head in Dili.
Despite a huge international effort to rebuild and develop East Timor since its traumatic break from Indonesian rule seven years ago, it remains Asia's poorest country.
The heady days of independence are more muted now
Unemployment is at least 40%, and much higher among young men.
Hopes for independence were always dangerously high, and there is simmering resentment in much of the population over the minimal improvement to their lives.
Far more worrying, though, is the involvement of East Timor's small army, and the poor performance of its young police force, in confronting the unrest.
The rioting spread from a demonstration by some of nearly 600 soldiers. They were sacked in March after going on strike over what they claimed was discrimination against those from the west of the country.
The government has now set up a body to examine their grievances and called on the UN to extend its small remaining mission in East Timor to help improve training.
That may help, but the problems plaguing the security forces run deep and the government has lost a lot of the popular respect and support it enjoyed when independence was declared four years ago.
The army was created from the armed resistance force, Falintil, which earned mythical status for its long struggle against the Indonesian occupation.
Feb: More than 400 troops strike over pay and conditions
March: Government sacks nearly 600 of 1,400-man army
April: Rioting by sacked troops leaves five people dead
May: Violence intensifies; government appeals for foreign assistance
But converting it into a regular army was not a straightforward process.
Experience and skills varied - some fighters were barely educated and there were many who claimed to have fought but did not.
Falintil was also split by rivalries between regions and different commanders.
The UN relied heavily on President Xanana Gusmao and commanders loyal to him, most of them from the east, to decide who got jobs in the new army, which only numbered 1,500.
Those who were left out have often led protests against the government, despite the creation of special veterans' commissions to determine compensation.
One well-known veteran who was rejected, Ely Foho Rai Bot, also known as L7, leads a powerful paramilitary organisation, called Sagrada Familia, that has been accused of ties to smuggling.
Army commander Taur Matan Ruak, Falintil's highly respected leader in its final years of struggle, insists he must maintain standards of discipline and loyalty within the ranks. But others in the government say he may have acted insensitively in sacking the striking soldiers.
The government is standing by his decision but it also has credibility problems.
Many ministers spent the 24-year occupation in exile and have a weak rapport with the population, who suffered under Indonesian rule.
Prime Minister Mari Alkitiri is a particular target of popular anger.
Very capable as an administrator and negotiator, he is viewed as cold and intolerant by many ordinary Timorese, and has had to fend off persistent allegations of corruption among his family.
His party, Fretilin, is also often seen as arrogant in the way it exercises power.
Perhaps the most controversial minister is Rogerio Lobato, minister for the interior.
The brother of Falintil's first commander, he also spent the occupation in exile and has a frosty relationship with President Gusmao and many of today's army leaders.
His position puts him in charge of the police force, which has been widely criticised for using excessive force, most recently by the US-based group Human Rights Watch, which documented several cases of rape and torture.
Yet Mr Lobato has bought large quantities of new weapons for the police and set up two special paramilitary police units.
Some analysts fear growing rivalry between the police and army.
The enormous destruction inflicted by departing Indonesian troops left East Timor with no functioning institutions. Even after years of rebuilding, local government and the judicial system are very weak.
The revenues from East Timor's offshore oil reserves have yet to start flowing in and it still is not clear how well the government will spend them.
Add to that an increasingly frustrated population and the potential for future unrest is high.
In these conditions, the instability within the army and the failings of the police force could prove very dangerous to the country's stability.