A gas explosion that ripped through a barbecue restaurant in northwestern China killed at least 31 people, officials said on Thursday, hours after the blast had turned the restaurant into a charred ruin.

The explosion hit the two-story restaurant in Yinchuan, the capital of the Ningxia region, at 8:40 p.m. on Wednesday, when it was busy with customers eating lamb kebabs and other dishes cooked on gas burners. Firefighters rushed to the scene, where thick smoke rose into the sky and shattered glass and debris covered the street. They put out the fire within an hour.

The scale of death became clear to the public only on the following morning, when the authorities announced the death toll and that seven other people were hospitalized with injuries, one in critical condition.

Chinese Communist Party authorities have become increasingly effective at withholding details of accidents and disasters until they are in full control of the situation. A brief initial report from Xinhua, the official news agency, had said one person was killed and 20 injured. It did not mention the possibility of more dead.

On Thursday, officials in Ningxia promised a thorough investigation of the blast and announced a campaign to improve safety. China’s top leader, Xi Jinping, issued a statement of condolence, as he usually does after major accidents. Mr. Xi noted that the explosion happened on the night before the Dragon Boat Festival, or Duanwujie, a traditional Chinese holiday. “Pay attention to hidden, emerging risks and carry out comprehensive safety checks,” he said.

The deadly explosion is likely to result in closer scrutiny of China’s booming barbecue restaurant industry. Overall, China’s safety record in mines and work sites has been improving, according to official statistics, and local governments often order checks of restaurants and their gas supplies. But serious accidents persist.

In late 2021, an explosion in a barbecue restaurant in Shenyang, in northeast China, killed five people. Earlier this month, a Chinese news website about the dining industry counted at last 11 gas explosions in restaurants since June 2022, some of them deadly.

A full official account of the cause of the latest accident is likely to take weeks or months. But Xinhua, citing police and fire department records, said restaurant employees remembered detecting a gas leak about an hour before the explosion and tracing it to a broken valve. The blast happened while the valve was being replaced. Two phone numbers registered under the restaurant’s name were out of service.

Later on Thursday, Xinhua reported that the operator of the restaurant and eight other staff members or shareholders in the business had been placed under police control (a euphemism usually meaning detention), and their assets had been frozen. Government authorities were still trying to determine the identities of the dead, the report said.