A plane belonging to the chairman of the U.S. Joint Chiefs of Staff was apparently attacked by insurgents in Afghanistan on Tuesday.

Militants fired rockets at the Bagram Airfield outside Kabul, and shrapnel hit Army Gen. Martin Dempsey’s C-17 military plane, according to NATO officials. Dempsey was not in the plane at the time, but several members of the maintenance crew suffered minor injuries. A helicopter also was damaged.

“The chairman was in his room at the time of the incident and was unharmed,” said Maj. Lori Hodge, a spokeswoman for NATO forces in the country. “Due to some exterior damage to General Dempsey’s aircraft, he left Afghanistan on a different military plane.”

Officials said that “indirect fire” on the airfield, such as rockets and mortar shells that are not aimed by line of sight, is not uncommon. They said they did not think the plane was targeted because it belonged to Dempsey.

The Taliban asserted responsibility for the attack. Zabiullah Mujahid, a spokesman for the radical Islamist movement, denied a NATO officer’s assessment that the insurgents fired a “lucky shot,” saying instead that the plane was targeted “using exact information,” news agencies reported.

The incident serves as a reminder that even in relatively secure parts of the country, insurgents have managed to maintain both a physical presence and significant weapons caches. Last month, the Taliban publicly executed a woman accused of adultery in Parwan province, where Bagram Airfield is located.

During Defense Secretary Leon E. Panetta’s trip to Afghanistan in March, an Afghan civilian stole a military pickup truck and rammed it through a fence near the airfield in an apparent attempt to attack Panetta’s plane.

Dempsey devoted much of his visit Monday to a discussion of “insider attacks” — in which Afghan soldiers and police officers target their NATO counterparts. Nine U.S. troops have been killed in such attacks in two weeks.

Later Tuesday, Dempsey arrived in Baghdad, where he was expected to discuss military cooperation between the United States and Iraq, the Associated Press reported. His brief visit to the country is the first by the top U.S. general since American troops withdrew from Iraq in December.