A team of heavily armed militants launched a brazen attack on Pakistan's largest civilian airport on Sunday, killing at least 13 people and setting the airport ablaze during a night-long assault.

Police said up to 10 attackers wearing suicide vests managed to enter Jinnah international airport in Karachi carrying assault rifles and rocket-propelled grenades, apparently accessing sensitive areas of the airport through a service gate near to a terminal used by VIPs including the prime minister and foreign dignitaries.

The attack on the airport of Pakistan's economic capital was one of the most audacious the country has seen for years and is likely to sharpen criticism of the government's policy of attempting to negotiate a peace deal with the Tehreek-e-Taliban Pakistan (TTP), the country's main militant group.

The attack began shortly before midnight and the noise of heavy gunfire and at least two loud explosions were heard in the course of the night. About five of the terrorists appeared to have gained access by shooting their way through a side gate near the old terminal. At least five others may have blasted their way through a wall near the cargo area, officials said.

At least some of the gunmen wore the uniforms of the airport security force that protects the nation's airports, said an official who briefed journalists near the airport.

He said all were strapped with explosives. One tried to capture a vehicle used by the civil aviation authority and when a guard shot at him, the explosives strapped to his body went off. The official said another attacker also blew up after being shot at by security forces.

Thick smoke billowed from a fire that appeared from TV pictures to be perilously close to commercial airliners, although army officials said no planes had been destroyed.

Fire illuminate the sky above Jinnah International Airport in Karachi. Photograph: Shakil Adil/AP

It was unclear if the fire was deliberately started by the attackers or resulted from fighting with the army troops who rushed to the scene.

Officials inside the airport said at least three planes had been damaged during the fighting, however. Abid Qaimkhani, a spokesman for the aviation authority, said some planes had been hit by gunfire, but said that none had caught fire.

Chief minister of Sindh province, Qaim Ali Shah, said the attackers intended to destroy some of the aircraft and buildings but were stopped before they could complete their attack. "They were well trained. Their plan was very well thought out," he told reporters.

One senior Pakistani intelligence official, speaking to the Washington Post on condition of anonymity, said some of the militants tried to hijack a plane, but were unsuccessful.

Hospital officials said they had seen nine bodies: seven airport security personnel, a Pakistan International Airlines employee, and an official with Pakistan's civil aviation authority.

A few hours into the fighting, Pakistani army spokesman General Asif Bajwa said the attackers had been "contained in one area", thought to be near a maintenance area. At 4.30am local time, the army reported that all 10 attackers had been killed. They also said that all passengers who had been on aircraft were safely moved into the main terminal building.

But there was an anxious wait for many. Farooq Sattar, a senior member of the Muttahida Qaumi Movement (MQM), the party that dominates Karachi, was on a London-bound plane as it taxied into position at the end of the runway. "It was a very close call because we would have passed right past terminal one [where the fighting was taking place]," he said.

Pakistani security troops rush to Jinnah International Airport in Karachi. Photograph: Shakil Adil/AP

The plane taxied back to the gate but no one was allowed to disembark, he said, causing panic among passengers worried about the aircraft's full tanks of fuel. "I myself called some important officials, saying the main concern of the passengers was: God forbid if they manage to come near our plane – they were already out there on the tarmac."

Eventually the passengers were allowed back into the departure lounge, but were barred from leaving the airport. Inbound flights were hastily diverted to other airports, some hundreds of miles away from Karachi.

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

The attack is an embarrassing blow to the government on several levels. It will once again highlight concerns the country is not able to protect sensitive targets from militant groups fighting against the Pakistani state.

The attack comes just three years after the Mehran naval airbase, just three miles from the airport, suffered a similar attack when a team of militants killed 10 military personnel and destroyed two aircraft.

Pakistani security officials take positions after suspected militants attacked Jinnah international airport in Karachi. Photograph: Shahzaib Akber/EPA

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

The attack could also deal a major blow to business confidence, which had begun to perk up following the election of industrialist Nawaz Sharif as prime minister.

Sharif's faction of the Pakistan Muslim League are anxious to attract foreign investors back to Pakistan, 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 bring to the country.

Sharif has long wanted to attract foreign airlines back to Pakistan, including British Airways, which cut its services following major terrorist attacks.

Sunday's developments will also increase pressure on the government over its strategy for trying curb Islamist militants, who say they are fighting to impose strict sharia law on the country.

The gunmen are thought to have disguised themselves as police guards and stormed a terminal used for VIPs and cargo. Photograph: Shakil Adil/AP

Since coming to power, Sharif has attempted to open peace talks with the Pakistani Taliban, ignoring critics who believe violent militants have to be brought under control by force.

A major faction of the Pakistani Taliban last month announced it had split from the militant outfit following bloody clashes with a rival group since March but they have not renounced violence.

There was no claim of responsibility for the attack, which appeared well planned and executed. But Karachi is home to thousands of suspected Pakistani Taliban militants, who have been waging a bloody insurgency against the government.

In an apparently unrelated attack on Sunday night, at least 20 Shia pilgrims returning from Iran were killed when suicide bombers entered the hotels where they were staying, officials said. The attack occurred in Taftan in the western province of Baluchistan, near Pakistan's border with Iran.

The home minister for Baluchistan province, Mir Sarfraz Bugti, said four suicide bombers struck in two separate hotels late on Sunday night. Ten pilgrims were also wounded in the attacks.