Defense Secretary James Mattis’ plane was the target of a rocket attack at Kabul international airport on Wednesday during an unannounced visit to meet Afghan President Ashraf Ghani, the Taliban said.

As many as 40 rockets and rocket-propelled grenades struck the airport in a hail of fire, but Trump’s top defense official had already left the airport, along with NATO Secretary General Jens Stoltenberg. The attack left at least five people wounded when a rocket hit a home near the airport. 

Both the Taliban and the Islamic State militant group (ISIS), who are competing against one another in the country, claimed responsibility for the attack.  Zabihullah Mujahid, a Taliban spokesman, claimed the group’s involvement in a post on his official Twitter account. 

ISIS claimed the attack on its self-styled news agency, Amaq, saying that “infiltrators” had used SPG-9 rockets and mortars.

The State Department and the Pentagon did not respond to a request for comment. Ghani said that Afghan special forces had brought the incident under control.

At a press conference with Stoltenberg and Ghani at the Afghan presidential palace in Kabul, Mattis said "an attack on an airport anywhere in the world is a criminal act by terrorist.”

"If, in fact, this is what they have done, they will find the Afghan Security Forces continuing on the offensive against them in every district of the country right now," Mattis added.

Mattis’ visit was the first trip by a top official in the Trump administration to Afghanistan since the president announced a new strategy of expansion in the country to combat radical Islamist militants in August. He spoke of the importance of Trump’s new strategy in seeking an end to extremist violence that has blighted the country for more than a decade.

"A lot is riding on this of course as we look toward how do we put an end to this fighting and the threat of terrorism to the Afghan people, to the international community and how do we put this into a path of political reconciliation," he said.

The defense secretary said that the Trump administration would do everything it could to prevent the Taliban gaining a foothold in the country and to not allow “a merciless enemy to kill its way to power.” He said he hoped the new strategy would bring the Taliban back to the negotiating table.

"I want to reinforce to the Taliban that the only path to peace and political legitimacy for them is through a negotiated settlement,” Mattis said.

The Taliban has been waging an insurgency against Afghan and Western forces since the U.S. invasion of the country in 2001, which overthrew the rule of the militant group.

The number of U.S. personnel in Afghanistan is around 8,000, and Mattis has pledged to send 3,000 more to help boost the defense of the country, but to also train the Afghan security forces.

Ghani praised the new strategy in a speech at the U.N. General Assembly in New York last week. "With President Trump's recent announcement of his strategy to counter terror and stabilize South Asia, Afghanistan's enduring partnership with the United States and the international community has been renewed and redirected,” he said.