Panetta's comments Friday came after Karzai said the United States is not doing enough to fight terror in neighboring Pakistan, CNN reported.
Karzai accused the United States and NATO Thursday of attacking insurgents in Afghanistan instead of targeting their supporters Pakistan.
"The U.S. and NATO should go to the places where the roots of terrorism exist. They are saying one thing but acting contrary to that," Karzai said at a news conference in Kabul.
Tensions between the United States and Afghanistan have escalated in recent months due to a series of fatal attacks on U.S. troops by their Afghan counterparts, as well as the accidental killing of civilians.
"Look, we have made progress in Afghanistan because there are men and women in uniform who have been willing to fight and die for Afghanistan's sovereignty," Panetta told reporters shortly after landing in Lima, Peru, Friday for a meeting with Latin American defense officials.
"Those lives were lost fighting the right enemy not the wrong enemy, and I think it would be helpful if the president, every once in a while, expressed his thanks for the sacrifices that have been made by those who have fought and died for Afghanistan, rather than criticizing them," Panetta said.
Texas principal bans speaking Spanish, stirs controversy
Toddler uninjured after being knocked over by Obama family dog