The Taliban unleashed a barrage of rockets and suicide bombers detonated their vests at Kabul's international airport Wednesday, the attack coming fewer than two hours after U.S. Defense Secretary James Mattis arrived there.

Mattis had already left the airport aboard helicopters to attend a meeting with Afghanistan’s President Ghani when the attack occurred.

The Afghan Crisis Response Unit responded to the attack and U.S. forces supported them in the air, but a missile malfunctioned and caused "several" friendly casualties, officials said.

Afghan special forces managed to repel the attackers, killing four in the ensuing gunbattle.

Officials said an investigation into the attack has been opened and more details would be released in the coming days.

Mattis arrived in Kabul just after 11 p.m. ET -- 7:30 a.m. in Kabul --after spending Tuesday in India. NATO Secretary General Jens Stoltenberg was also on the flight.

Mattis spoke about the attack at a news conference in Kabul, alongside Afghanistan's president.

“If in fact there was an attack on an international airport anywhere in the world, if it's an attack by a terrorist it's designed to go after innocent people," Mattis said. "And this is a classic definition of what the Taliban is up to now."

"We will suffocate any hope that Al Qaeda or ISIS or the Taliban have of winning by killing. I want to reinforce to the Taliban that the only path to peace and political legitimacy to them is through a negotiated settlement," Mattis added.

This is Mattis' first trip to Afghanistan since President Donald Trump announced a new strategy for Afghanistan, recommitting to the country and declaring during a prime-time address back in August that U.S. troops must “fight to win.”

The new strategy for the 16-year-old war includes sending roughly 3,500 more U.S. troops to Afghanistan to join the 11,000 on the ground.

Sixteen years after the 9/11 attacks, Kabul is still being attacked by the Taliban. On Tuesday in Washington, Gen. Joe Dunford, chairman of the Joint Chiefs of Staff, said it's time to demand that Pakistan stop giving sanctuary to the Taliban.

Already the U.S. military is stepping up its air strikes in Afghanistan. In August, more bombs were dropped on the Taliban and an ISIS-affiliated group than any month since 2012.

The director of the Kabul airport said all flights have been halted as result of the mortar attack at the airport.

Fox News' Lucas Tomlinson and the Associated Press contributed to this report.