Indonesia declared martial law today in violence-wracked East Timor, where rampaging militias -- backed by locally recruited soldiers and policemen -- began executing independence leaders and rounding up thousands of people in an apparent effort to crush opposition to continued Indonesian rule.

The declaration places East Timor under direct military control and suspends all civil liberties in the island territory. But many people here questioned the rationale for the ruling, since the military was already supposed to be in charge in the territory, and some worried that the declaration might give legal cover to even more army-backed violence.

"They are going to use martial law privileges to shoot more people legally," East Timorese independence activist Jose Ramos-Horta told a television interviewer.

Australian Foreign Minister Alexander Downer said the martial law announcement could be a prelude to intervention by a U.N.-sponsored peacekeeping force -- now being formed -- if the Indonesian government cannot quell the violence in East Timor. (Story on Page A15).

The declaration came as diplomats and other analysts here said they had received evidence that thousands of Indonesian troops and policemen native to East Timor had deserted their units and were joining with the pro-Indonesian militias in their bloody campaign against the independence movement.

"It's a mutiny-like situation," said a Western military analyst. "You've got a breakdown of command and control and a lot of desertions."

Analysts said the desertions raised questions about whether Gen. Wiranto, commander of the Indonesian armed forces, could be orchestrating the mayhem, or, perhaps more worrisome, whether he had lost control of the army. The government of President B.J. Habibie announced Monday that it had rejected a proposal by Wiranto to institute martial law in East Timor, so the overnight turnaround led many here to wonder exactly who is in charge in Indonesia -- Habibie or Wiranto.

The mounting bloodshed in East Timor, and the involvement of large numbers of soldiers and policemen, seemed likely to damage Indonesia's international image just as the country was hoping to show the world it had shed its authoritarian, sometimes brutal past and was ready to join the community of democratic nations.

"This is bad not only for Timor but Indonesia as a whole," said a Western diplomat in Jakarta, the Indonesian capital. "If these dark forces can take over in Timor, can they do the same here?"

In an apparent effort to counter such perceptions, the Jakarta government this morning freed the jailed leader of the East Timorese independence movement, Xanana Gusmao, a 53-year-old Jesuit-trained poet-turned-guerrilla who has been widely expected to become the first president of an independent East Timor.

Gusmao, who has been seen as a voice of moderation and conciliation in his homeland, served six years of a 20-year sentence -- the last seven months under guard at a government guest house. His intentions were not immediately clear. In a brief statement after his formal release at the Justice Ministry, he declared only: "I promise as a free man I will do everything I can to bring peace to East Timor."

The government had initially wanted to send Gusmao directly to Dili, East Timor's capital, but his supporters rejected that proposal, saying it amounted to a virtual death sentence since the anti-independence militias control the streets. He has been offered asylum in the United States and Australia, but his lawyers said the resistance leader had not yet decided what course he will take.

The violence gripping East Timor has shattered a U.N.-sponsored peace plan for the territory just a week after voters there overwhelmingly rejected a referendum on autonomy, opting instead for independence from Indonesia. The United Nations now has no presence in the Western part of the territory, half its staff is being evacuated, and most of those who remain are barricaded in their compound, unable to venture outside.

In Dili, well-armed militiamen fired into the International Red Cross compound Monday, shot at the Australian ambassador's car and burned down the home of the city's Roman Catholic archbishop and spiritual leader, Carlos Belo, the 1996 Nobel Peace Prize winner. Belo was not harmed and was taken by police helicopter to the eastern city of Baucau, to the home of fellow Bishop Basilio de Nascimento, who described Belo as in "a state of shock."

The death toll from the rampage was believed to be in the hundreds, and one diplomat here said she had heard reports of bodies being dumped into mass graves across the territorial border in West Timor, which is part of Indonesia. Among those targeted for execution were well-known independence leaders, according to diplomats and other sources.

"In Atambua [in West Timor], we have heard reports that many people are being killed, and big holes are being dug to bury them," said Ana Gomes, who heads the Portuguese consulate here. The reports could not be independently verified, as most journalists and other international officials have left the territory.

"This is a nightmare," Gomes said. "This is as bad as the things we had in Rwanda" during the 1994 massacre of Tutsis by Hutu militants.

An estimated 6,000 East Timorese serve as troops and noncommissioned officers in the Indonesian armed forces in the territory -- including two all-Timorese battalions. In addition, about 1,000 East Timorese serve in the national police force in Timor, according to military analysts. Most of these soldiers and police officers are said to have mutinied and to be responsible for much of the current mayhem.

Diplomats, U.N. officials and other foreigners in East Timor have reported seeing policemen and army troops firing on vehicles and openly assisting the anti-independence militias. Until Monday, diplomats and others had said they were unable to confirm that any troops had deserted their units.

Wiranto has said he is sending three more army battalions to East Timor to help quell the violence, which erupted Saturday after the results of the Aug. 30 referendum showed that an overwhelming 78.5 percent of East Timorese voters had chosen not to remain part of Indonesia.

Some of those troops have already arrived, but diplomats there said that the soldiers, many of them Javanese, have found themselves outnumbered by the East Timorese mutineers and that there already may have been clashes. "We've already heard reports of soldiers shooting soldiers," a Western military analyst said.

While the situation in East Timor appeared to be out of control, diplomats and others said the word "anarchy" does not properly describe conditions there. Armed mobs rule the streets, they said, but they appear to be acting with purpose and direction. The violence also seemed well-planned.

Take for instance the assault on Archbishop Belo's residential compound, which had become a makeshift refugee camp for more than 5,000 people who had fled the fighting and believed the house to be a sanctuary. Among those who sought refuge there was Olandina Kairu, a well-known independence leader.

When the militiamen came to Belo's residence, they fired into the compound but apparently at the ground, not directly at the people. They then loaded the people onto military trucks, and various reports said they were taken west to Atambua.

Afterward, Belo was given safe passage by Indonesian police, who flew him to Baucau. His house was then set ablaze. There was no word on Kairu's fate.

Next to Belo's house is the compound of the International Red Cross, which had become a haven for about 2,000 people. Some reports said militiamen first separated the East Timorese from the foreigners at the compound, then marched them away. The foreigners -- 11 Red Cross staff members and eight other aid workers -- were turned over to the police and then taken to the airport to leave.

As of midday today, the martial law declaration seemed to be having little impact. About 10 a.m., the U.N. compound in Baucau came under a sustained, 15-minute attack by militiamen, prompting the Australian government to send in a C-130 cargo plane to evacuate 138 foreigners, including U.N. staff members and other aid workers. Baucau was the only U.N. post remaining outside of Dili.

In Dili, a U.N. spokesman reached by telephone said there had been continuous automatic weapons fire outside the U.N. headquarters compound since dawn. "We're hunkered down and we're taking care of the 1,500 refugees here as best we can," he said.

East Timor was a Portuguese colony until 1975, when a civil war broke out between pro- and anti-Marxist groups. Portugal -- beset by political upheaval at home -- withdrew from the territory and Indonesian troops invaded. Indonesia annexed the territory the following year, a move recognized by few countries.

For the past 24 years, East Timorese guerrilla forces have waged a low-level campaign for independence from Jakarta. The territory, roughly the size of Connecticut, has a population of about 800,000 and occupies about half the island of Timor.