Indonesia and Portugal signed an agreement in 1999, which authorised the UN to organise a referendum on autonomy for East Timor.
When the East Timorese voted for independence, pro-Jakarta militia launched a campaign of looting, killing and arson throughout the territory. The Indonesian security forces did little to intervene. And the UN peacekeepers found themselves marooned in their building in Dili, with no authority to stop the violence.
The Security Council then authorised an Australian-led international force with a mandate to use "all necessary means" to bring the situation under control. The intervention force arrived within two weeks of violence erupting, and has been held up as a model of professionalism.
But the militias still managed to destroy most of the country's infrastructure, leaving the UN with an unprecedented challenge to rebuild the country almost from scratch.