Mr Gates described the Swat offensive as encouraging
Pakistan's several peace deals with the Taliban have led to an upsurge in violence in Afghanistan, US Defence Secretary Robert Gates has said.
Mr Gates told the US senators that steps taken over the next 18 months to defeat the militants will decide if the war in Afghanistan is being won.
The US is sending 21,000 additional troops to the country, to join an existing force of 38,000.
It says the policy of "appeasement" has allowed militants to regroup.
Pakistan has now launched an offensive against Taliban militants along its western border.
"To a considerable degree, the beginning of greater Taliban activity in Afghanistan began as Pakistan started these peace agreements with various insurgent and extremist groups on their western border, which then freed the Taliban to come across the border as they felt no pressure from the Pakistani army," Mr Gates said before a congressional committee on Tuesday.
The US defence secretary said the problem became worse because of the violence caused by the Taliban coming across the border from Pakistan.
"I think it is self-evident that we were under-resourced to deal with it," he said.
"We did not have the military capabilities or the civilian capabilities, in terms of counter-insurgency, to be able to deal with it."
Mr Gates said Pakistan's military offensive against Taliban in the Swat valley was "an extremely important development".
The army has been carrying out an air and ground assault against the militants in three districts in and around the Swat valley.
And on Tuesday, the Pakistani army began shelling Taliban hide-outs in the Bannu district of the country's north-west, officials and local people said.