Almost 180 passengers and crew on board a SpiceJet flight that was preparing for a takeoff from Kabul's Hamid Karzai International Airport had a narrow escape when the Taliban launched a rocket attack near the airport.

According to a SpiceJet spokesperson, the boarding for its flight SG 22 was almost complete when the attack took place.

The spokesperson was quoted by IANS as saying: "Passengers and crew were safely deboarded and taken to the terminal building. There was no damage to the aircraft."

Taliban launched around 20 rockets, which landed near the airport after US Defence Secretary Jim Mattis arrived in Kabul hours before.

"Passengers and crew were safely deboarded and taken to the terminal building."

Mattis arrived in Kabul to meet Afghanistan President Ashraf Ghani along with NATO chief Jens Stoltenberg to talk on NATO’s mission designed to bolster Afghanistan’s military, reported Economic Times.

On Twitter, the Taliban stated the launch of the attack was to target Mattis.

The SpiceJet plane was slated for take-off at 11.20 am when the airport came under attack.

The budget carrier operates five flights every week to Kabul. Air India also has direct flights to Kabul four times a week.