(CNN) -- Shrapnel from indirect rocket fire Tuesday damaged the plane that had carried the top U.S. military officer to Afghanistan, officials said.
Gen. Martin Dempsey, the chairman of the Joint Chiefs of Staff, was in his room on the base at the time of the incident and was "not in any danger," said his spokesman, Col. David Lapan.
It's a reminder that "there's no place in Afghanistan that's safe," said John Pike, director of GlobalSecurity.org, which tracks security issues.
Dempsey arrived in Afghanistan Monday for meetings with coalition and Afghan leaders, including Gen. John Allen, commander of NATO forces, and Afghan Army Gen. Sher Mohammad Karimi, Dempsey's counterpart in the country.
The C-17 was parked at Bagram Air Field, outside Kabul, overnight when it was hit by shrapnel from two rockets, Lapan said. Two base maintenance personnel were slightly injured, he said.
A NATO helicopter also was damaged, the alliance said.
The incident caused Dempsey and his team to change planes and leave Afghanistan a few hours later than planned, Lapan said.
The U.S.-controlled base comes under rocket or mortar fire about twice each month, but there is rarely any damage, officials said.
Dempsey's visit to Afghanistan came at a time of growing attacks on U.S. forces by Afghan security force personnel.
An incident Sunday brought the death toll in attacks by Afghan military and police personnel this year to 40, according to U.S. military officials.
Twenty-three of those killed were Americans, according to the U.S. Defense Department.
In March, an Afghan man drove a stolen vehicle onto a runway just after U.S. Defense Secretary Leon Panetta's plane landed at Camp Bastion airfield. The British vehicle was stolen about 30 minutes before the attack "with the intent to harm," a Pentagon spokesman said.
Any kind of attack on a military site affects public opinion and can help undermine support for the war, said Anthony Cordesman, who analyzes the region for the Center for Strategic and International Studies. That's especially true for one that grabs more attention because a high-ranking official is there, he said.
It weakens the military in the eyes of Afghans and other countries, he explained.
"The minute you can get constant reminders that (insurgents) are still able to attack, even if the attack doesn't mean that much, it has a political effect," Cordesman said Tuesday.
Pike said such attacks show "that we've been there for over a decade and the security situation has not improved dramatically."
While the Afghan military and police forces keep growing, their efforts combined with foreign troops have turned things around the way the "surge" did in Iraq, he said.
"The surge in Iraq was responding to a very specific security situation -- vendetta killings," said Pike, whereas in Afghanistan the goal has not been as specific.
President Barack Obama and U.S. military officials have said progress is being made in Afghanistan, including training Afghan forces to take control when U.S. troops leave by the end of 2014.
CNN's Josh Levs contributed to this report.