A fire raced through a garment factory in Bangladesh (search), killing 22 people who were trapped because most of the exits were locked, officials said Friday.

Rescuers recovered the victims' charred bodies after the fire destroyed the Sun Knit (search) garment factory late Thursday in Siddhirganj, an industrial town near the capital, Dhaka (search), fire brigade official Nurul Islam said.

Nearly 500 workers — many of them women — were in the four-story building when the fire started, Islam said, adding the cause was being investigated.

Islam said the factory lacked adequate safety features and most of the exit stairs were locked during the blaze.

"All of the victims were trapped inside the factory and charred," Islam said.

Firefighters stopped searching for more bodies in the debris Friday morning, while hundreds of onlookers flocked to the factory to search for loved ones.

"None of my seven tenants returned home last night," landlord Fatema Begum told The Associated Press. Poor garment workers usually share rooms in rented properties near their workplace. "I went to the morgue, but could not identify the charred bodies."

Factory worker Nilu Khatun said she escaped with about 20 co-workers through one of the few unlocked exits.

"I took my son in one hand and ran for the stairs, and suddenly all became dark," said Khatun, who suffered cuts and bruises. "It was a terrible night in my life. I thank Allah for saving my son."

Fires in garment factories are common in Bangladesh because of poor safety. Bangladesh exports more than $5 billion in textiles each year.