A fire that swept through a privately run home for the elderly in central China killed 38 people and left much of it a charred ruin, raising concerns over the safety of facilities housing the country's rapidly aging population.

The fire broke out Monday night in the Kangleyuan Rest Home, which housed 51 residents in the city of Pingdingshan in Henan province, the province's work safety administration said in a statement. In addition to the dozens who died, six people were injured, including two in serious condition, the statement said.

A photo of the fire scene released by China's official Xinhua News Agency showed that many sections of the facility appeared to have completely burned down. Xinhua said a rescue operation was still underway Tuesday morning and that the cause of the fire was unclear.

"I was in my bed at the time. Suddenly, I saw a worker run out of a room on fire and he shouted 'Run! Run!' to me, so I dashed out," Guo Xin, 78, was quoted by Xinhua as saying.

Another survivor, 82-year-old Zhao Yulan, said only two of the 11 people living in her room made it out alive, Xinhua reported. Some of the remains of people killed in the fire were burned beyond recognition, the news agency said.

The fire destroyed a part of the home housing people who are completely dependent on others for care. Xinhua quoted 80-year-old resident Chen Runsheng as saying not enough caregivers were working at the facility.

Police took the facility's legal representative into custody pending an investigation into the blaze, and were questioning the staff, Xinhua said.

Chinese President Xi Jinping urged rescue personnel to urgently aid the injured and victims' families, and to determine the cause of the fire and who was responsible, Xinhua reported.

Premier Li Keqiang called on officials across the country to "draw lessons from the accident, checking all potential safety hazards to avoid similar incidents," Xinhua said.

With a rapidly aging population and under-resourced social security net, China faces increasing pressure to provide safe and affordable care for the elderly. Xinhua cited figures showing a severe shortage of caregivers in the country, with 220,000 working in homes for the elderly, while 10 million are needed.

"The tragedy is a sore reminder" that facilities for the elderly are still far behind where they should be, Xinhua said in a commentary on the blaze. The shortage means some people "have no other choice but to live in poorly equipped nursing facilities," it said.

In 2013, a disgruntled resident set fire to a home for the elderly in Heilongjiang province in northeastern China, killing himself and 10 others.