The government blamed the attack on Islamic State (IS) extremists but there was no immediate confirmation from the group.

Scenes of chaos and panic unfolded on Tuesday night as gunfire and explosions sent crowds fleeing in all directions.

Airport surveillance video posted on social media appeared to show one explosion, a ball of fire that sent terrified passengers racing for safety.

Another appeared to show an attacker, hit by a gunshot from a security officer, blowing himself up seconds later.

A growing stream of travellers, some rolling suitcases behind them, fled down a corridor, looking fearfully over their shoulders.

"Four people fell in front of me. They were torn into pieces," said airport worker Hacer Peksen.

The victims included at least 13 foreigners and several people remained unidentified on Wednesday. The toll excluded the three bombers. The Istanbul governor's office said more than 230 people were wounded.

It was not clear if any attackers were still on the loose.

The attackers arrived by taxi, officials said.

"When the terrorists couldn't pass the regular security system, when they couldn't pass the scanners, police and security controls, they returned and took their weapons out of their suitcases and opened fire at random at the security check," said Prime Minister Binali Yildirim.

All three attackers arrived together at the lower-level arrivals hall; one went inside, opened fire and then detonated his explosives, according to an Interior Ministry spokesman and another official.

During the chaos, the second attacker went upstairs to departures and blew himself up.

The third man waited outside during the whole episode and detonated his explosives last as people flooded out of the airport, the officials said.

Separately, a senior Turkish security official said the three attackers were not Turkish nationals. All officials spoke on condition of anonymity.

Paul Roos, a South African tourist who was due to fly home with his wife, said he heard shots while coming up the escalator.

"There was this guy going roaming around, he was dressed in black and he had a handgun."

Funerals for some of the victims began on Wednesday as Turkish authorities tried to piece together how the attack happened, going through surveillance footage and interviewing witnesses to establish a preliminary timeline.

As dawn broke over the destroyed terminal, workers began removing debris.

The airport reopened on Wednesday morning, in sharp contrast to the 12-day complete shutdown in Brussels after the deadly airport bombing there in March.

An information board inside showed about a third of scheduled flights were cancelled and a host of others were delayed.

By evening, the IS group had not claimed responsibility for the attack, although it did issue an infographic celebrating two years since announcing a caliphate. It claimed to have "covert units" in Turkey, among other places, according to the SITE Intelligence Group.

"So, what can we think? We cannot think anything," said Ali Batur, whose brother died. "A terror attack might happen everywhere, it happens everywhere... If God permits, we will get over this in unity and solidarity."

Mr Yildirim said it appeared that the IS group, which has threatened Turkey repeatedly, was responsible.

"Even though the indications suggest Daesh, our investigations are continuing," Mr Yildirim said, using shorthand for IS. He also suggested the attack could be linked to steps Ankara took on Monday towards mending strained ties with Israel and Russia.

US President Barack Obama pledged to dismantle "organisations of hate" after the bombing.

He said the gun and bomb attacks show how little these "vicious organisations" have to offer.

Mr Obama offered his condolences to the Turkish people, and has spoken with Turkish President Recep Tayyip Erdogan.

Earlier, Russian President Vladimir Putin expressed condolences for the Istanbul attack, and sought to begin a process of improving relations with Turkey.

Belgian PM Charles Michel said on Twitter: "Our thoughts are with the victims of the attacks at Istanbul's airport. We condemn these atrocious acts of violence."