By Ahmed Mengli, Mushtaq Yusufzai and Alexander Smith
KABUL, Afghanistan — The Taliban claimed it fired at least six rockets at Afghanistan's main airport Wednesday in an attack intended to target Defense Secretary James Mattis.
No one was injured and Mattis had left the airport in the capital Kabul hours beforehand, according to Afghan President Ashraf Ghani.
The defense secretary was in the country for an unannounced visit alongside NATO Secretary General Jens Stoltenberg. It was his first trip to Afghanistan since President Donald Trump announced a new strategy for America's longest war.
Although the trip was not publicized, two Taliban commanders told NBC News on condition of anonymity that their "insiders" in the Afghan security establishment and at Kabul airport had tipped them off in advance.
"We fired six rockets and planned to hit the plane of U.S. secretary of defense and other U.S. and NATO military officials," said one of the commanders. "We were told by our insiders that some losses were caused to their installations but we are not sure about James Mattis."
Taliban spokesman Zabihullah Mujahid confirmed the Taliban's claim of responsibility and said their target was the defense secretary and other U.S. officials.
Let our news meet your inbox. The news and stories that matters, delivered weekday mornings.
Just because a militant group lays claim to an attack does not mean it was actually responsible.
ISIS, which has built up a presence in Afghanistan and opposes the Taliban, issued a competing claim of responsibly via its affiliated news agency, Amaq, according to Reuters and others. NBC News was not immediately able to confirm the reports.
ISIS and the Taliban have claimed responsibility for the same attack before, notably in June last year when the rival militant groups said they were behind a deadly car bomb in Kabul.
Whoever was responsible for today's attack, the defense secretary was far away when the rockets were launched. As news of the attack came in, Mattis was already busy holding a press conference with Ghani and Stoltenberg elsewhere in the capital.
"If in fact there was an attack ... his is a classic statement to what Taliban are up to," Mattis told reporters. "If in fact this is what they have done, they will find Afghan security forces against them."
Stoltenberg added that "an attack on civilian airport is sign of weakness, not of strength."
The Afghan president confirmed that "there has been an attack" and said Afghan special forces were dealing with the situation.
Najeeb Danish, a spokesperson with the Afghan interior ministry, told NBC News that six rockets were fired, and that security forces had surrounded two houses near the airport in their search for suspects.
All departures and arrivals at the airport were canceled for at least two hours, according to the country's ministry for civil aviation.
The Pentagon officially acknowledges 8,400 troops are on the ground in Afghanistan, but defense officials told NBC News last month that number actually hovers between 11,000 and 12,000.
Earlier this month, Mattis said earlier this month that the U.S. would send an additional 3,000 troops to the country.
Ahmed Mengli reported from Kabul, Mushtaq Yusufzai reported from Peshawar, Pakistan, and Alexander Smith reported from London.
Ahmed Mengli is a journalist based in Kabul, Afghanistan.
Mushtaq Yusufzai is a journalist based in Peshawar, Pakistan.
Alexander Smith is a senior reporter for NBC News Digital based in London.