A brawl involving as many as 2,000 workers forced Foxconn to close its Taiyuan plant in northern China late on Sunday, and left a number of people needing hospital treatment.

"The fight is over now … we're still investigating the cause of the fight and the number of workers involved," said Foxconn spokesman Louis Woo, adding it was possible it involved "a couple of thousand workers".

A police statement reported by the official Xinhua news agency said 5,000 officers were dispatched to the scene.

The violence was brought under control after about four hours and 40 people were taken to hospitals for treatment, the Taiwanese-owned company said. It said several people were detained by police.

The violence did not appear to be work-related, the company and police said.

Comments posted on Chinese internet bulletin boards said it might have erupted after a security guard hit an employee.

The Taiyuan plant, which employs about 79,000 workers, makes parts for automotive electronics and assembles various electronic devices, according to Woo. Other staff sources said it makes parts for and assembles Apple's new iPhone 5, released last week.

It was not clear how long the shutdown would last at the plant.

Woo said the fight happened in the workers' dormitory facilities. Photographs of the incident that were posted to social networks but later deleted showed smashed windows and riot police, and crowds of workers.

Later pictures from just outside the plant showed workers clearing shards of glass from broken windows at a building by an entrance gate and a line of olive-coloured paramilitary police trucks parked inside the factory grounds.

Geoffrey Crothall, spokesman for the pressure group China Labor Bulletin, told the New York Times workers at the plants had become increasingly emboldened.

"They're more willing to stand up for their rights, to stand up to injustice," he said. The same plant was the subject of a brief strike over pay in March.

Foxconn, the trading name of Taiwan's Hon Hai Precision Industry Company, is the world's largest contract maker of electronic goods. It has seen a few violent disputes at its sprawling plants in China, where it employs a total of about 1 million workers. It is an important supplier for companies including Apple, Hewlett-Packard and Microsoft.

Hon Hai shares were down 1.14% by late on Monday morning, lagging behind the broader market's decline of 0.28%.

In June, about 100 workers went on a rampage at a Chengdu plant in south-west China. The company has faced allegations of poor conditions and mistreatment of workers at its Chinese operations, and has been spending heavily in recent months to raise wages and improve working conditions.

A staff member at the Taiyuan plant said he was told the plant could be closed up to two to three days while police investigate.

"There are a lot of police at the site now," the staff member, who asked not to be named, told Reuters by telephone.