THESE are worrisome times for China's rulers. The Communist Party's credibility was already damaged by a collision of two high-speed trains on July 23rd that left 40 people dead and prompted even the state-supervised media to indulge in a rare outcry about official disregard for public safety. Now comes a demonstration in the north-eastern city of Dalian that has prompted a remarkable climb-down by the authorities. On August 8th a storm smashed through the protecting wall of a paraxylene (PX) factory in the city. To Chinese environmentalists PX, a chemical used to make polyester, is synonymous with toxicity. Around 12,000 people joined the protest demanding the plant's closure. Demonstrations of this size are exceptional in China's boomtowns.

So too are immediate capitulations. The protest was generally orderly (the worst violence reported was a few plastic water bottles thrown at riot police). But its mobilisation without clear leadership, with the help only of mobile telephones and the internet, must have unnerved officials made jumpy by fears that China might copy the Arab Spring. Some demonstrators came prepared, with banners and face masks printed with a no-entry sign over the letters PX. Dalian's party chief, Tang Jun, tried to placate the crowd by standing atop a police van, promising through a megaphone that the plant would be relocated. He was greeted by disdainful chants.

Later in the day, officials announced that they would close the factory. This is no small matter for Dalian, a city which earlier in the week had been basking in a glow of patriotism after the launch of the country's first aircraft-carrier from there. Chinese media say that 9.5 billion yuan ($1.5 billion) has been invested in the factory, a joint venture between a private developer and a state-owned chemical company.

The siting of the factory so near the centre of Dalian was remarkable given an outcry in 2007 over plans for a similar project in the southern city of Xiamen. Tens of thousands of protesters rallied there too, prompting officials to locate the factory elsewhere. The Xiamen demonstrations are often cited as one of the first and most dramatic displays of a growing willingness of urban Chinese to confront officials over environmental issues.

Since the high-speed train crash, there has been much debate about the power of internet social-networking services to wrong-foot the government. Officials have now leapt gleefully upon the British government's criticism of their use during recent rioting in England. “Advocates of an unlimited development of the internet should think twice about their original ideas”, crowed the Beijing-based Global Times a day before Dalian erupted.

True to form, the authorities have clamped down. Searches for the terms PX, Dalian and even “stroll” (a euphemism in China for protest) have been blocked on Chinese microblogs. In a country choked with polluting factories, the authorities do not want to encourage copycats.