Updated

With fearful residents cowering indoors, security forces patrolling a tense town in western Myanmar collected bodies Monday from the debris of homes burned down over the weekend in some of the country's deadliest sectarian bloodshed in years.

The Buddhist-Muslim violence, which has left at least seven people dead and hundreds of homes torched since Friday, poses one the biggest tests yet for Myanmar's new government as it struggles to reform the nation after generations of military rule. The handling of the unrest will draw close scrutiny from Western powers, which have praised President Thein Sein's administration in recent months and rewarded it by easing years of harsh economic sanctions.

Thein Sein declared a state of emergency in the region late Sunday and pleaded for an end to the "endless anarchic vengeance," warning that if the situation spun out of control, it could jeopardize the democratic reforms he has launched since taking office last year.

"We have not had any sleep for the last five days," said Ma Ohn May, a 42-year old textile shop owner in the coastal port of Sittwe, adding that residents were holed up and bracing for further ethnic clashes, though the area was calm Monday.

The United Nations said it had temporarily relocated 44 of its 150 personnel in Rakhine state. Local state television said cargo and passenger boats to Sittwe were suspended.

Violence between ethnic Rakhine Buddhists and members of a Muslim minority who call themselves Rohingyas erupted Friday in Rakhine state and spread Saturday to Sittwe.

The unrest -- trigged by the alleged rape and murder last month of a Buddhist girl by three Muslims and the June 3 lynching of 10 Muslims in retaliation -- stems from long-standing tensions in the region.

The region's Rohingya Muslims are seen by the government as illegal migrants from Bangladesh and are not officially recognized as one of the country's national ethnic minorities. Although some are recent settlers, many have lived in Myanmar for generations. The government position has rendered the Rohingyas effectively stateless, and rights groups say they have long suffered discrimination.

"It's a tinderbox," said Phil Robertson, the deputy Asia director for Human Rights Watch. "These people very much feel like they're trapped in a box, surrounded by enemies and there is an extremely high level of frustration."

The Rohingyas' plight gained international attention in 2010 when five boatloads of haggard migrants fleeing Myanmar were detained by Thai authorities and allegedly sent adrift at sea with little food and water. Hundreds were believed to have drowned.

International relief agencies believe an estimated 800,000 Rohingya living in Myanmar's mountainous Rakhine state, which borders Bangladesh. Thousands attempt to flee every year to Bangladesh, Malaysia and elsewhere in the region, trying to escape a life of abuse that rights groups say includes forced labor, violence against Rohingya women and restrictions on movement, marriage and reproduction that breed anger and resentment.

In Sittwe on Monday, shops, schools and banks were closed, including the city's main market and some ethnic Rakhines wielding homemade swords could be seen guarding their homes or riding motorcycles. An Associated Press photographer in the town saw many homes burned or ransacked in the city's Mi Zan district.

Police retrieved four corpses, including one found in a river that was believed to be that of an ethnic Rakhine woman. The other three bodies were wrapped in blankets, but it was not clear who they were.

Police evacuated two Muslim families from the same area for their security because their Muslim homes were located among houses of ethnic Rakhines, who are predominantly Buddhist.

Ma Ohn May, the shop owner in Sittwe, said she and her colleagues had heard rumors that Muslims were approaching the coastal market by boat to launch an attack. She said her Buddhist cousin, living in the Muslim-dominated town of Maungdaw, had taken refuge in the local police headquarters.

Her house has been damaged and she is living in fear," Ma Ohn May said, adding that food and water were in short supply.

Thein Sein's state of emergency was his first since becoming president. The measure allows the military to take over administrative functions for Rakhine State, a coastal region that borders Bangladesh.

In a nine-minute speech televised nationally Sunday night, Thein Sein said that the violence was fanned by dissatisfaction harbored by different religious and ethnic groups, hatred and the desire for vengeance.

"If this endless anarchic vengeance and deadly acts continue, there is the danger of them spreading to other parts and being overwhelmed by subversive influences," he said. "If that happens, it can severely affect peace and tranquility and our nascent democratic reforms and the development of the country."

In contrast to the previous military regime, Thein Sein's government has been relatively open in releasing timely information about the recent trouble. Under the former ruling junta, such incidents usually went unreported or were referred to only in brief, cryptic fashion.

Thein Sein was elected with the backing of the military, but discarded many of its repressive policies to seek accommodation with the pro-democracy movement of Nobel peace laureate Aung San Suu Kyi.