Indonesia is to resettle thousands of people whose homes have been engulfed by mud surging from a gas exploration site. Efforts to stop the flow of mud have failed.

Indonesian President Susilo Bambang Yudhoyono has declared the part of East Java affected by the mud flow a disaster zone and ordered the resettlement of thousands of residents.

The mud has buried four villages and displaced more than 10,000 people since it started spewing from a drilling shaft in Sidoarjo in eastern Java nearly four months ago.

Officials say 50,000 cubic meters of mud are pouring into the area daily and more than 270 hectares have been affected. Workers are struggling to contain the flow with dams.

Spokesperson for the Indonesian president, Andi Mallarangeng, says the government may have to dump treated mud into a nearby river if it threatens more homes.

"Some of the mud could be flowed into the Porong River in an emergency situation. Some of them will be put into a landfill or something," Mallarangeng says. "The effort to stop the mud still has been continued because some of the experts said there still is a possibility to stop the mud."

The geothermal mud contains toxins that have caused respiratory and stomach illnesses in the surrounding area.

Indonesian officials say the sludge may be dumped into the sea, but only as a last resort.

Indonesia's environment minister had warned against disposing of the mud in the ocean because it would kill wildlife and fish vital to the local economy. But he now supports the move, saying the treated mud will not be toxic.

Mallarangeng says human health must come before environmental health in an emergency.

"It is a difficult decision, but we have to prioritize the people who might be threatened by the mud," Mallarangeng says.

Protesters from Greenpeace dumped hundreds of kilograms of the sludge outside the office of the minister for welfare, Aburizal Bakrie. His family owns a controlling share in Lapindo, the company drilling at the site of the mud spill.

The gas exploration company has denied wrongdoing, but the protesters, and government officials, have called for the company to pay for the disaster.

The company has been trying to stop the sludge by drilling relief wells and pumping concrete into the shaft, but experts say the mud volcano is one of the largest ever recorded on land and may be too powerful to stop.