Chinese authorities have ordered a petrochemical plant to shut down immediately after tens of thousands of protesters marched through the streets of a nearby city, demanding the factory be relocated.

The demonstration in Dalian – one of the biggest in a series of recent Nimby rallies against potential polluters in China – was sparked by the news last week that a protective dike around the Fujia factory, in the Jinzhou industrial complex, had been breached by rain and high waves as typhoon Muifa approached.

In a rare concession the local Communist party chief, Tang Jun, and Dalian's mayor, Li Wancai, promised to move the project out of the city, Xinhua reported.

The protesters demanded a clear timetable for moving the plant, with some refusing to leave until a plan was in place, the state-run news agency said.

Minor scuffles were reported at the demonstration, but the ranks of riot police mostly looked on as the largely peaceful and white-collar crowd – variously estimated at 10,000 to 70,000 – assembled without a permit in People's Square.

Some chanted old revolutionary songs, and others held banners spelling out local concerns about the factory, which produces paraxylene (PX), a benzene-based chemical widely used in plastic bottles and polyester clothing.

Mobile phone photographs of the protest have circulated rapidly on the internet. Slogans included "PX Out!", "Refuse PX", "PX out of Dalian". Some protesters wore gas masks; others stood on top of a police car.

The gathering was organised through websites such as Sina Weibo and Renren, despite the efforts of censors to remove comments calling for action. David Gao, a local student, said the demonstration grew so large that it expanded beyond the concrete square outside the city government office and into local streets.

"We need to kick the PX factory out of Dalian to protect our environment," he said. "If something as serious as the storm happens again, it will be a disaster.

No poisons are thought to have leaked during last week's storm, but thousands of local residents were evacuated. Some said they did not trust official reports. "Even if there was contamination, the government would restrict the news," said Cindy Xin, who was taking part in a demonstration for the first time.

Concerns about the safety of the plant were heightened by reports that Chinese reporters who went to investigate were denied access and beaten by security guards.

PX plants are far from being the most dangerous of China's chemical facilities, but they have proved politically toxic. In 2007, tens of thousands of people in the southern city of Xiamen went on a protest walk against a PX plant, prompting the local government to move the facility out of its jurisdiction.

Several of the online notices about the Dalian protests referred to the Xiamen case, to a large oil spill in Dalian last year and to recent leaks from an oil field in the nearby Bohai Sea that went unreported for a month.

Additional research by Han Cheng