By Agence France-Presse
People ran screaming out of Resorts World Manila, which is across a road from the Philippines' international airport, after the man fired what police chief Ronald dela Rosa said was an M4 assault rifle and set fire to a gambling table about midnight.
The gunman did not shoot anyone but disappeared into the chaos of smoke and running people, leading to a manhunt throughout the casino, hotel and shopping complex that ended just after dawn.
"He's dead. He was killed by our troops," Dela Rosa told the GMA television network.
Before the gunmen had been killed and police had confirmed any motive, the Islamic State group claimed responsibility and US President Donald Trump also branded it a "terrorist attack" .
However the incident was most likely a robbery gone wrong rather than a terrorist attack, Dela Rosa and Manila police chief Oscar Albayalde told reporters.
Dela Rosa said the man, who appeared to be acting alone, walked into one of the gambling 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 them.
The man left the room and went upstairs to the hotel section, according to Dela Rosa.
Albayalde said the gunman had tried to steal 113 million pesos ($2.3 million) worth of gambling chips, although he left the backpack on the ground near the stock room.
"There is no indication that this is a terror attack," Albayalde told reporters outside the casino.
"It is a simple robbery and most likely it was done by a demented person."
Dela Rosa was less equivocal, saying that it appeared not to be a terrorist attack but that an investigation would determine the gunman's motive.
- Terrified -
People inside the casino recounted feelings of terror when the shooting occurred.
"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.
ISIS is another acronym for the Islamic State group.
"Guests were screaming. We went to the basement locker room and hid there. People were screaming, guests and employees were in panic," Navaro said.
"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."
Outside the complex, relatives of people caught inside waited 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."
Police said there had been no confirmed fatalities but 30 people had been injured in the stampede and from inhaling smoke.
Philippine President Rodrigo Duterte imposed martial law last week across the southern region of Mindanao to crush what he said was a rising threat of IS there.
He declared martial law shortly after militants went on a rampage through the southern city of Marawi, which is 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 171 people dead.
Duterte said last week he may need to declare martial law across the rest of the country if the terrorism threat spread.