Chinese authorities bowed to public pressure and performed a rare U-turn yesterday by scrapping plans for a copper alloy plant in a Sichuan city after large-scale protests against the proposed facility turned violent.

Residents of the small city of Shifang – worried that the plant would pose environmental and health risks – were warned by police that they would be "severely punished" if they continued to demonstrate against the project for a third day yesterday. Riot police reportedly used tear gas and stun guns on the crowds, which numbered tens of thousands, according to Hong Kong media.

Protesters were reported to have smashed police cars and stormed the Shifang government headquarters.

Initially the local government said it would suspend the project planned by the company Sichuan Hongda, one of the country's biggest zinc and lead producers, but authorities later bowed to public pressure and withdrew the plans.

"The molybdenum-copper alloy factory will no longer be built in Shifang city," the local government body said in a statement on the Twitter-style Chinese micro-blogging website Sina Weibo.

"At present, the... mass incident has basically [been brought] under control, and the majority of people have dispersed," it added.

The protests began peacefully on 1 July, with many of the demonstrators merely gathering outside a factory carrying colourful umbrellas to highlight their cause. But riot police moved in on Monday to break up thousands of protesters who had gathered outside the city's government building. At least 13 people were injured, according to local authorities.

"We aren't afraid of them [the authorities]," an 18-year-old saleswoman, who declined to be identified, told Reuters by telephone from Shifang yesterday before plans for the plant were withdrawn. "The Shifang people will definitely not surrender," she said.

Demonstrators who refused to heed authorities' warnings against the gatherings yesterday carried red banners reading "Get rid of the Hongda molybdenum plant, return beautiful new Shifang to me", according to pictures. Photographs posted online, purportedly showing riot police firing stun grenades and using tear gas against the crowds, which included children and the elderly, prompted an outpouring of anger across China.

Grass-roots environmental movements have become more vocal in China in recent years. Residents in Shifang, which was badly hit by the 2008 earthquake that killed 88,000 people in the south-west of the country, have complained that they were not consulted on plans for the plant.

The effects of pollution are a leading cause of unrest as the country's rapid economic rise is accompanied by often chronic environmental effects. The air in most cities is already difficult to breathe.

Environmental protesters are often members of China's middle-class, worried about dangers to their families that environmental degradation can cause. Residents of Shifang were said to be anxious that the proposed plant would poison them. China's growing middle-class is the core support for the Communist Party, and the government must be mindful of its views if single-party rule is to continue to function in China.

There is heightened sensitivity over signs of instability this year due to the high-level power transition planned for the autumn, which will see Vice- President Xi Jinping take over from President Hu Jintao.

The government blamed yesterday's protests on the banned spiritual movement, Falun Gong, and the exiled Tibetan spiritual leader, the Dalai Lama, for trying to unsettle people in the town and cause unrest in China.

The Shifang case bears parallels with a similar protest in the north-eastern Chinese city of Dalian last year, when 12,000 demonstrators protested against a petrochemical plant that recently caused a toxic spill scare. Attempts to build a giant PX plant in the city of Xiamen in Fujian province were foiled by a major middle-class demonstration on the streets in 2007.