The United Nations is in the "advanced stages" of planning for military intervention in East Timor to try to help halt the rampant violence that followed the territory's vote for independence last week, senior U.S. and U.N officials said today.

Australia, New Zealand, Britain, Canada and a handful of other countries have made commitments to participate in a multinational force that U.N. sources say could total 5,000 to 7,000 troops with the authority to crack down on rampaging anti-independence militia groups, the officials said. But they said that any decision to order foreign troops into East Timor would require the approval of the Indonesian government and the U.N. Security Council.

The mission, which has been the subject of weeks of secret negotiations at the world body, would probably be led by Australia, the sources said. If it receives the green light, it would be prepared to begin deployment within a week, according to diplomats familiar with the plan.

A senior U.S. official said the United States would probably provide logistical and political support for the operation, but no troops. President Clinton spoke by phone today with Australian Prime Minister John Howard, who has put Australian troops on emergency alert for possible deployment.

Senior U.S. and U.N. officials were anticipating Indonesian President B.J. Habibie's declaration of martial law, which will provide his army one last opportunity to demonstrate it can end the violence. But if it is unable to restore calm within two to four days, the officials said, the government will face intensive pressure to let foreign troops do the job.

U.N. Secretary General Kofi Annan said tonight that he and Habibie had reached agreement on the "need for further measures to be taken to restore law and order in East Timor and secure the safety of [U.N.] personnel and all East Timorese."

Annan's envoy to East Timor, Jamsheed Marker, said that Indonesia has failed in its obligation to ensure security in the territory. Secretary of State Madeleine K. Albright, in a news conference in Hanoi, said for the first time that Indonesia needs to consider asking for help.

"Either the Indonesian government takes care of the violence or lets the international community be of assistance," Albright told reporters.

The U.N Security Council, meanwhile, dispatched a team of five diplomats from Britain, the Netherlands, Namibia, Malaysia and Slovenia to Jakarta to press the government to exert control over the rampaging militias, soldiers and policemen in East Timor.