Updated

A pay dispute was resolved Thursday at a medical supply factory, ending a labor standoff in which the Chinese workers detained their American boss for nearly a week inside the plant until they reached agreement on a compensation package.

Chip Starnes, a co-owner of Florida-based Specialty Medical Supplies, told The Associated Press he had been forced to give in to what he called unjustified demands while he was held by about 80 workers inside the factory, an experience he described as "humiliating, embarrassing."

The workers began blocking all exits from the plant in Huairou district on the outskirts of Beijing on June 21 after seeing equipment being packed for shipment to India and thinking the entire factory was being shut down. They said the company owed them unpaid salary.

At the start of the standoff, the workers deprived Starnes of sleep by shining bright lights and banging on windows of his office, he said.

Police had made no moves to end the standoff but guarded the plant and said they were guaranteeing Starnes' safety while a labor official was brought in to broker negotiations.

It's not rare in China for managers to be held by workers demanding back pay or other benefits, often from their Chinese owners. Police are reluctant to intervene, as they consider it a business dispute, and local officials typically are eager to see the matter resolved in a way least likely to fuel unrest.

Starnes, who had spoken to reporters in recent days through the barred window of his factory office, said the workers' demands were unjustified. Neither he nor district labor official Chu Lixiang gave details of the compensation deal.

Chu said all the workers would be terminated, although Starnes said some would be rehired later.

"It has been resolved to each side's satisfaction," Chu told reporters at the plant. She said they had been sorting out paperwork until 5 a.m. and that 97 workers had signed settlement agreements.

Starnes had quietly departed the factory grounds by the time Chu spoke. He wrote in a text message: "Yes!! Out and back at hotel. Showered. 9 pounds lost during the ordeal!!!!!!"

He told the AP he was "saddened" by the experience.

He has said the company had been winding down its plastics division, with plans to move it to Mumbai, India. When he arrived in Beijing last week to lay off the last 30 people, workers in other divisions started demanding similar severance packages.

The deal reached Thursday would also pay those workers, even though the company said they weren't being laid off.

"We have transferred our funds from the U.S.," he said. "I am basically free to go when the funds hit the account here of the company."

Starnes said he planned to get back to business, and even rehire some of the workers who had been holding him.

The labor action reflected growing uneasiness among workers about their jobs amid China's slowing economic growth and the sense that growing labor costs make the country less attractive for some foreign-owned factories.