Image caption Mr Starnes said the workers made unjustified demands

US businessman Chip Starnes has been freed after being detained by workers in his factory in China for nearly a week over a dispute.

Mr Starnes and a union official said an agreement had been reached overnight.

Mr Starnes, co-owner of US company Speciality Medical Supplies, said workers had "barricaded" him in after demanding severance pay.

However the workers said the dispute was over pay arrears, and that some had not been paid for two months.

There have been numerous labour disputes in China's factories in recent years, where workers are not always fully protected.

'Profits and pitfalls'

The incident in the factory in Huairou, Beijing, reportedly began on Friday.

Mr Starnes said workers blocked all exits and, when he tried to sleep, banged on doors and windows.

They had demanded severance packages although not all of them had been laid off, he said.

The experience was "humiliating" and "embarrassing", he added.

However, workers said they had not been paid for two months, something Mr Starnes denied.

The workers feared the plant was closing and remaining staff would be left without severance payments, local labour official Chu Lixiang said in an earlier interview.

On Thursday, she said that the dispute had "been resolved to each side's satisfaction", adding that the deal was not finalised until the early hours of morning.

Local police did not intervene, saying the matter was a civil dispute for the two sides to resolve themselves, the BBC's China Correspondent Damian Grammaticas reports.

The incident is an illustration of the way doing business in China can be profitable but also full of pitfalls, our correspondent adds.