A masked gunman set fire to a gaming room at a casino in the Philippine capital on Friday, igniting a toxic blaze claimed by the Islamic State group that killed 37 people, authorities said.
IS said its "fighters" carried out the attack, though Manila has repeatedly insisted the incident was not terror related.
The victims suffocated inside one of the main gambling venues of the upscale Resorts World Manila, while dozens of other people were injured in a panicked crush to escape, police said.
The gunman committed suicide by setting himself on fire about five hours after storming the casino with an M4 assault rifle and a bottle of petrol that he used to start the fire, police chief Ronald Dela Rosa said.
Dela Rosa and other police officials insisted the assailant was not carrying out a terrorist attack, pointing out that he did not shoot anyone, and said it appeared to be a bizarre robbery attempt by a "deranged" man.
"This is not an act of terror. There is no element of violence, threat or intimidation that leads to terrorism," Dela Rosa told reporters.
But local police chief Tomas Apolinario told AFP that 37 people died from inhaling smoke from a fire that spread quickly because of flammable carpet on the gaming room floors.
Four of the victims were from Taiwan, according to the Taiwanese government.
The gunman initially disappeared into the chaos of smoke and running people, leading to a five-hour manhunt through the complex, which also includes a hotel and shops, according to Dela Rosa.
He said the assailant, who appeared to be a foreigner because he spoke English and looked caucasian, was found just before dawn in a hotel room having committed suicide.
"He lay down on the bed, covered himself with a thick blanket, apparently poured petrol on the blanket and burned himself," Dela Rosa said.
- Terrorism fears -
Before the gunman had been killed and police had given any motive, there was an unconfirmed claim of responsibility from the Islamic State group. US President Donald Trump also branded it a "terrorist attack".
The IS group's self-styled Amaq news agency carried a brief message in Arabic on Telegram, which said: "Islamic State fighters carried out the attack in Manila in the Philippines yesterday".
In a later statement posted on Telegram from one of IS's regular and authenticated accounts, the group went on to provide the gunman's "nom de guerre" and boasted of killing and injuring nearly 100 "Christians" during the rampage.
But Philippine officials were adamant it was not related to terrorism, and was the work of an individual.
"This particular situation in Manila is not related in any way to a terrorist attack," presidential spokesman Ernesto Abella told reporters.
Dela Rosa said the man, acting alone, walked into one of the gaming rooms and fired the rifle at a large television screen, then poured gasoline onto a gambling table and set it alight.
He said the man then fired again at a stock room containing gambling chips and filled a backpack with chips worth 113 million pesos ($2.3 million).
The man left the room and went upstairs to the hotel section, but left the backpack, according to Dela Rosa.
The police chief said 18 of the 54 injured people were in hospital, while the others sustained only minor injuries.
- Screaming guests -
People inside the casino recounted a terrifying ordeal when the shooting broke out.
"I was about to return to the second floor from my break when I saw people running. Some hotel guests said someone yelled 'ISIS'," Maricel Navaro, an employee of Resorts World, told DZMM radio, referring to another acronym for the Islamic State group.
"When we smelled smoke, we decided to go for the exit in the carpark. That's where we got out. Before we exited, we heard two gunshots and there was thick smoke on the ground floor," Navaro said.
Outside the complex, relatives of people trapped waited on Friday to hear news of their loved ones.
"Our daughter called us past midnight saying she was in the VIP section of the casino and there was smoke and they were suffocating," Gil Yongco, 42, told AFP.
"We are very worried about her. We haven't heard from her."
Their daughter, Hazel, died, authorities announced later.
President Rodrigo Duterte imposed martial law last week across the southern region of Mindanao to crush what he called a rising threat from IS.
He made the move shortly after militants went on a rampage through the southern city of Marawi, about 800 kilometres (500 miles) south of Manila.
Security forces are still battling the militants in Marawi, and the clashes there have left at least 175 people dead.
Duterte said last week he might declare martial law across the rest of the country if the terrorism threat spread.