Insurgents fired mortars and detonated suicide vests Wednesday in an attack targeting Kabul's international airport during a visit to Afghanistan by Defense Secretary Jim Mattis, and U.S. forces responded with an airstrike that inadvertently caused civilian casualties, authorities said.

According to the U.S.-led NATO mission in Afghanistan, insurgents used civilians as human shields during the assault, in which they "fired several rounds of high-explosive ammunition, including mortars," into the airport area. A statement by the Resolute Support mission provided no details on the number of insurgents or casualties.

It said U.S. forces conducted an airstrike to help an Afghan unit end the assault. "Tragically, one of the missiles malfunctioned, causing several casualties," it said. "Resolute Support deeply regrets the harm to non-combatants." No further information on the strike or its consequences was immediately available.

The Taliban and the Islamic State issued competing assertions of responsibility for the airport attack, which was carried out while Mattis and the NATO secretary general met with President Ashraf Ghani and other Afghan leaders miles away at the heavily fortified presidential palace.

The attack forced authorities to cancel all flights. The Interior Ministry said one Afghan civilian was killed and at least 11 others were injured after an insurgent rocket hit a house near the combined civil and military airport.

The Taliban has fired rockets on the airport in the past, and Wednesday's attack coincided with the anniversary of the Islamist extremist group's capture of Kabul in 1996. For its part, the Islamic State often asserts links to attacks without offering any clear evidence.

The latest airport attack was unprecedented in scope, lasting more than six hours. The U.S. military and NATO use the airport, and it was not immediately clear whether runways or aircraft were damaged.

The barrage included at least 12 rockets fired from at least two locations, according to police. One security official, speaking on the condition of anonymity to discuss the attack,said more than 30 rockets were fired on the airport and its vicinity.

Speaking in a news conference with Mattis, Ghani described the attack as "a sign of weakness, not strength" on the part of insurgents.

"It is a classic example of what the Taliban are up to right now," Mattis said.

Mattis and NATO Secretary General Jens Stoltenberg spoke with Ghani about plans to strengthen Afghanistan's military as it faces a resurgent Taliban and factions backing the Islamic State.

"If NATO forces leave too soon," Stoltenberg said, "there is a risk Afghanistan may return to a state of chaos and once again become a safe haven for international terrorism."

Mattis's visit was his first since President Trump announced a new strategy for Afghanistan in August, including a stepped-up military campaign against the Taliban and efforts to shut down sanctuaries for militants across the border in Pakistan.

Ghani said Trump's plans have given Pakistan "a golden opportunity" to confront the Taliban and other militant factions.

Defense secretary visits to Afghanistan are tightly managed and planned well in advance but not disclosed until after the secretary's arrival.

Ahmad Saeedi, a political analyst and former Afghan diplomat, said only a few top people knew about the visit by Mattis and Stoltenberg, suggesting that the airport attack was a serious security breach.

"This creates a worry that the enemy has found a place even in our artery," Saeedi said.

Mattis travels abroad in a blue-and-white plane, known as the E4B, that is emblazoned with "United States of America." But when visiting war zones, he usually switches to a lower-profile, gray military jet.

He landed at Kabul airport Wednesday in a C-17 transport and was not there during the attack, U.S. officials said.

Dan Lamothe, Alex Horton and William Branigin in Washington contributed to this report.