Airport battle lasted six hours and left 28 dead as any deal with militant group left in balance, after Islamabad vows retaliation

The Pakistani Taliban has claimed responsibility for a brazen attack on Pakistan's busiest civilian airport by 10 heavily armed gunmen that is likely to dash hopes of a peace deal with the militant group.

On Sunday night, the sound of gunfire and explosions could be heard in Jinnah international airport in Karachi, with television pictures showing a fire blazing not far from parked aircraft.

The operation to clear the airport continued for six hours until dawn, with 28 people reported killed, including all the attackers. An army spokesman declared the armed response a success, saying the militants – who were wearing the uniforms of the airport security force (ASF) – "were confined to two areas and eliminated".

The attack leaves in tatters the government's year-long effort to use the prospect of peace talks to avoid a military confrontation with the Tehreek-e-Taliban Pakistan (TTP). The TTP's spokesman, Shahidullah Shahid, said the talks had been a sham and that the attack was in revenge for the killing of Hakimullah Mehsud in November. The former TTP chief was killed by a CIA drone strike.

"Pakistan used peace talks as a tool of war. It killed hundreds of innocent tribal women and children. This is our first attack to avenge the death of Hakimullah Mehsud," he told Agence-France Presse. "We have yet to take revenge for the deaths of hundreds of innocent tribal women and children in Pakistani air strikes. It's just the beginning – we have taken revenge for one; we have to take revenge for hundreds."

In recent weeks the army has launched what it described as retaliatory air strikes and limited ground operations in North Waziristan, a tribal "agency" bordering Afghanistan that serves as an important sanctuary for the TTP.

The government had doggedly pressed on with peace talks efforts despite attacks continuing, even as government and TTP intermediaries began holding discussions earlier in the year. But the six-hour assault on the airport of Pakistan's economic hub is one of the most serious attacks the country has suffered for years.

It could provide the prime minister, Nawaz Sharif, with the political space he needs to back army demands for military operations in North Waziristan, a policy bitterly opposed by rightwing opposition parties, particularly Imran Khan's Pakistan Tehreek-e-Insaf (PTI).

"This act of terror is unforgivable," Khawaja Muhammad Asif, Pakistan's defence minister, said. "The state will give a fitting response to such cowardly acts of terror. Those who plan and those who execute the terrorist attacks will be defeated."

The attack began shortly before midnight – a busy time for both domestic and international flights – when 10 men armed with assault rifles and rocket-propelled grenades fought their way through two entrances to the airport. One group stormed a small terminal used for VIPs, including the prime minister and foreign dignitaries, while the other are thought to have entered through a gate used to get to a maintenance area. Security officials speculated that the group, which reportedly included suicide bombers, had hoped to hijack a plane but became pinned down before they were able to reach any aircraft.

Smoke rises above Karachi terminal on Monday after an attack by gunmen dressed as airport security. Photograph: Rizwan Tabassum/AFP/Getty Images

The dead included eight ASF members, two officials from the paramilitary rangers, one police officer and three staff members from the state carrier, Pakistan International Airlines (PIA). Although the army announced the successful conclusion of the operation about five hours after the attack, firing and explosions could still be heard for some time afterwards.

Broken glass and spent gun magazines littered the engineering section, where the first exchange of gunfire took place as smoke from grenade attacks began to dissipate. "I heard fierce firing and then saw the terrorists firing at the security force … Thank God I am alive. This is very scary," said Sarmad Hussain, a PIA employee.

Syed Saim Rizvi, who was on a plane on the runway, tweeted: "Huge blast!!!! I do not know what's going on outside – heavy firing started again – full panic on board!"

Soon after the attack began the airport was closed to flights, sending inbound planes to other cities and creating panic inside fully fuelled aircraft stuck on the ground.

One of the country's best-known politicians, a senior leader of the Muttahida Qaumi Movement (MQM), was on a plane that was taxiing in preparation for takeoff for London when the attack began. He said he frantically called senior contacts in the government, asking for the passengers to be allowed to disembark and go back into the airport. "It was a very close call, because we would have passed right past terminal one [where the fighting was taking place]," he said.

Syed Saim A. Rizvi (@saim_riz) Huge blast !!!!!! I do not know whats going on out side -- heavy firing started again - full panic on board !

The attack is embarrassing to the government on several levels. It will once again highlight concerns that the country is unable to protect extremely sensitive targets from militant groups fighting against the Pakistani state. It comes just three years after the Mehran naval airbase, three miles from the airport, suffered a similar attack, when a team of militants killed 10 military personnel and destroyed two aircraft.

The group also carried out a raid on Pakistan's military headquarters in the garrison city of Rawalpindi in 2009, leaving 23 dead, including 11 service personnel and three hostages.

Security measures at the airport have been criticised in the past. The road passing through the outer perimeter of the main terminal is guarded by security forces armed with dowsing rods, similar to the fake bomb detectors sold around the world by British conman Jim McCormick, who was jailed for fraud last year.

The attack could also deal a huge blow to business confidence, which had begun to improve after the election of industrialist Nawaz Sharif as prime minister. Sharif's faction of the Pakistan Muslim League is anxious to win back foreign investors, many of whom were scared away from the country by a sharp deterioration in internal security.

Karachi, the home of key industries including finance, is particularly important for the economic growth he vowed to deliver. Sharif has long wanted to attract foreign airlines back to Pakistan, including British Airways, which cut its services following terrorist attacks.