At least 36 people died from smoke inhalation at a Manila casino resort after a gunman burst into the gaming area and set gambling tables alight.
The gunman killed himself in a hotel room after being shot and wounded by security officers at the Resorts World Manila entertainment complex, police said. A second "person of interest" who was in the casino at the time was co-operating with the investigation, police said.
Most of the dead suffocated in the chaos. Many guests and staff had tried to hide from the gunfire rather than get out of the building when the attack began, shortly after midnight, and fell victim to the smoke, the fire bureau said.
Presidential spokesman Ernesto Abella confirmed reports by Philippine media that 34 bodies were recovered at the casino resort. He also said the incident was not linked to Islamist militants occupying a city in the southern Philippines, despite the terror network claiming responsibility for the attack.
"Islamic State fighters carried out the Manila attack in the Philippines," the militant group's Amaq news agency said.
That was quickly rejected by National Security Adviser Hermogenes Esperon, who said all the evidence pointed to an attempt to steal casino chips.
"This is plain and simple propaganda," Esperon told Reuters.
"If the lone gunman was really an IS terrorist, why did he not shoot and kill people in the casino? He only went for the casino chips."
Oscar Albayalde, chief of the capital's police office, said those who died were in the casino's main gaming area.
"What caused their deaths is the thick smoke," Albayalde said.
"The room was carpeted and of course the tables, highly combustible."
A Resorts World official said the dead included 22 guests.
At dawn, the body of the suspected gunman was found in a hotel room in the smouldering complex, which is close to Manila's airport.
"He burned himself inside the hotel room 510," national police chief Ronald dela Rosa told a news conference.
"He lay down on the bed, covered himself in a thick blanket and apparently doused himself in gasoline."
Resorts World Chief Operating Officer Stephen Reilly said casino guards had shot and wounded the gunman - armed with what authorities described as a "baby armalite" - during the attack.
"Severe loss of blood from the gunshot wound significantly slowed down the assailant and resulted to his holing up in the room where he took his own life," Reilly said.
Officials said at least 54 people were hurt, some seriously, as they rushed to escape what was at first was believed to have been a militant attack.
Survivor Magdalena Ramos, who was a guest at the hotel, said people began shouting "ISIS! ISIS!" when the gunfire began.
But police quickly said they did not believe the attacker had any militant connections.
"We cannot attribute this to terrorism," national police chief dela Rosa told DZMM radio.
"We are looking into a robbery angle because he did not hurt any people and went straight to the casino chips storage room. He parked at the second floor and barged into the casino, shooting large TV screens and poured gasoline on a table setting it on fire," he said.
Videos posted on social media showed people fleeing as several loud bangs went off.
The Philippines has been on heightened alert amid a crisis in the south of the country, where troops have been battling Islamist rebels since May 23.
Duterte declared martial law on the southern island of Mindanao last week and has warned it could become a haven for Islamic State supporters fleeing Iraq and Syria.