Taliban claims it targeted US defense chief's plane in attack on Kabul airport The Taliban and ISIS are both claiming the rocket attack at the Kabul airport.

 -- The Taliban and ISIS are both taking credit for a rocket attack on Kabul's airport early Wednesday just hours after U.S. Secretary of Defense James Mattis landed in Afghanistan for a surprise visit.

A barrage of up to 40 rounds of munitions hit the airport, including 29 rocket-propelled grenades, according to a U.S. military official.

In response to the attack, the U.S. conducted an airstrike to support an Afghan crisis unit on the ground, but "one of the missiles malfunctioned," causing injuries to Afghan civilians, the U.S.-lead coalition said in a statement.

Mattis had left the airport hours before the attack took place. NATO Secretary-General Jens Stoltenberg, who was in Afghanistan with the U.S. defense chief, was similarly out of harm's way when the rockets hit.

A separate U.S. military official told reporters traveling with Mattis that the secretary's C-17 aircraft had already departed Kabul for Bagram Airfield when the attack occurred. A spokesperson for the U.S. military in Afghanistan told ABC News that there are no reports of damage to coalition or Afghan military aircraft.

Though no U.S. personnel were injured, Afghan Interior Ministry spokesperson Najib Danish said one Afghan woman was killed and 11 civilians were wounded in the incident. Rockets hit two civilian homes close to the airport.

A U.S. military official told ABC News that two Hellfire missiles were fired from an Apache helicopter. One missile hit its target, while the second accidentally struck a structure, killing the one civilian and wounding several others.

"Resolute Support deeply regrets the harm to non-combatants," the coalition said in a statement on Wednesday. "We take every precaution to avoid civilian casualties, even as the enemies of Afghanistan continue to operate in locations that deliberately put civilians at very high risk. An investigation into the attack and the malfunctioning ammunition has begun."

Danish said later that four people allegedly involved in the attack were killed by Afghan special forces in an operation near the airport.

A Taliban spokesman tweeted that the attack was aimed at the secretary's plane.

ISIS also claimed responsibility for the rocket barrage.

Afghan President Ashraf Ghani said at a press conference that his country's special forces are "dealing with" the incident.

Mattis, standing with Ghani, called the attack a "criminal act by terrorists."

"It’s designed to go after generally innocent people to make some sort of statement," the U.S. defense chief said. "This is a classic definition of what the Taliban are up to right now. It defines their approach to how they see their role here and 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. So it is what it is, but it’s also the reason why we band together, and we don’t question what we’re doing here.”

This is Mattis' first trip to Afghanistan since President Donald Trump announced a new South Asia strategy that will send an additional 3,000 U.S. troops to the country.

Speaking to reporters traveling with the secretary, a U.S. military official said the Afghan conflict is at a "stalemate."

"We'd still put the conflict in this kind of bounds of the stalemate where neither side really has the capability right now to kind of have a decisive victory," the official said.

There are approximately 11,000 U.S. forces in Afghanistan now advising and assisting the country's military fight against the Taliban, as well as adding additional firepower to the counterterrorism mission against ISIS and Al Qaeda.

Next month, the U.S. war in Afghanistan will enter its 17th year.