Washington (CNN) -- A Pakistan-based terrorist group that is actively attacking American troops across the border in Afghanistan is an "arm" of the Pakistani intelligence agency, the top U.S. military officer told Congress on Thursday.
The blunt accusation from the chairman of the Joint Chiefs of Staff, Adm. Michael Mullen, reflected the growing impatience of U.S. officials with Pakistan's unwillingness to stop the attacks and the belief that Pakistan is actively supporting the insurgents.
But the recent high profile attacks by insurgents in Afghanistan represent a shift in strategy by the Taliban, who have ceded control of territory in much of the country, the U.S. secretary of defense said Thursday.
"The insurgency has been turned back in much of the country, including its heartland in the south, and Afghan National Security Forces are increasingly strong and capable," Secretary of Defense Leon Panetta said in a Senate Armed Service Committee hearing.
The attacks, including last week's attempt to strike at the NATO headquarters and the U.S. Embassy in Kabul and this week's assassination of former Afghan President Burhanuddin Rabbani, who was leading efforts for reconciliation talks, have raised questions about the ability of Afghan security forces to maintain control.
But Panetta, testifying to the committee along with Mullen, said the Taliban strikes are a sign of weakness.
"We judge this change in tactics to be a result of a shift in momentum in our favor and a sign of weakness in the insurgency," Panetta said.
He said many challenges remain.
"We must be more effective in stopping these attacks and limiting the ability of insurgents to create perceptions of decreasing security," he told the committee in his opening statement.
The chairman of the committee, Sen. Carl Levin, D-Michigan, said the ability of the Haqqani network, a Pakistani militant group accused of being responsible for last week's Kabul attack and numerous others in which U.S. and NATO troops have died, to launch attacks over the border from Pakistan is unacceptable. Levin expressed frustration with the Pakistani government, which has yet to use its troops to crack down on the insurgents and has not publicly condemned the attacks in Afghanistan, either.
Mullen, appearing for the last time in front of the committee before his retirement at the end of the month, spoke candidly about concerns about the threat posed by the Haqqanis.
Pakistan is "exporting" violence to Afghanistan, he said.
"The Haqqani network, for one, acts as a veritable arm of Pakistan's intelligence," Mullen said.
He said Pakistan's Inter-Services Intelligence agency supported the Haqqani insurgents who planned and executed the attack on the U.S. Embassy and other strikes in Afghanistan. In doing so, Mullen said, the agency is jeopardizing Pakistan's relations with the United States and Afghanistan. But he added that the solution is not to give up on Pakistan and said a flawed relationship is better than no relationship.
Mullen has spent a significant amount of time during his chairmanship building relations with the Pakistanis.
"Some say I have wasted my time," Mullen said, but he disagrees, saying the situation would be far worse if not for U.S.-Pakistan relations.
In recent meetings between U.S. and Pakistani officials, including Mullen with the top Pakistani military officer and CIA Director David Petraeus with Pakistani's top intelligence officer, the United States has pushed Pakistan to crack down on the Haqqani network, Panetta said. Given the public nature of Thursday's hearing, Panetta would not discuss what further steps the United States is willing to take to stop the attacks, but a U.S. official said this week that the CIA has increased drone strikes against the insurgent network within Pakistan.
In Pakistan, a spokesman for the Foreign Ministry denied that ISI supports the Haqqani insurgent group, brushing aside the U.S. categorization of the connection as "perceptions."
In a press briefing held in Islamabad on Thursday, spokesman Tahmina Junjua said Pakistan is not helping the Haqqani network.
Replying to a question on whether Pakistan is involved in a proxy war in Afghanistan, Junjua said, "I would say a categoric no."
Foreign Minister Hina Rabbani Khar said Friday that the accusations coming out of Washington are unacceptable to Pakistan.
"You will lose an ally," Khar said on GEO TV. "You cannot afford to alienate Pakistan. You cannot afford to alienate the Pakistani people."
Members of Congress have raised the idea of cutting back on the billions of dollars in aid given to Pakistan. Sen. Susan Collins, R-Maine, said the Senate Appropriations Committee has placed conditions on counterterrorism aid, including that the secretary of state must certify that Pakistan is cooperating in U.S. efforts against the Haqqani network and other terrorist groups.
Panetta differs with the State Department on whether that is a fair condition, but said he does support the message it will send.
"Anything that makes clear to them that we cannot tolerate their providing this kind of safe haven to the Haqqanis, and that they have to take action, any signal we can send to them I think would be important to do," he said.
The top Republican on the committee, Sen. John McCain, R-Arizona, called for slowing down the withdrawal of troops from Afghanistan to maintain the advantage of the surge of troops added last year.
Mullen said there is "increased risk" in pushing ahead with the withdrawal of 10,000 troops by next summer, as announced by President Obama.
"While the risk is up, I think it is manageable," and military success can still be sustained, he said.
McCain pressed Panetta on whether the Rabbani assassination shows the Taliban has no interest in reconciliation.
"It does raise concerns. It raises suspicions. Nevertheless, I think, obviously, we have to continue to try to pursue the opportunities that are out there. But we ought to do it with our eyes open," Panetta said. "The best signal we can send to the Taliban is that we're going to continue to fight them and that we're going to continue to be there, and that we're not going anywhere. And if we can send them that clear signal, I think that, more than anything, would influence their willingness to develop reconciliation."
The top commander in Afghanistan, Gen. John Allen, believes Taliban fighters in Afghanistan are upset and frustrated, Mullen said.
With "their leadership parked in Pakistan," Allen sees "the fighters on the field in Afghanistan are more and more disgruntled. Their morale is down," Mullen explained.
Regarding Iraq, Panetta said the United States continues to negotiate over any presence of American troops in that country after 2011. Currently, all U.S. troops will be withdrawing from the country, in accordance with the existing agreement with Iraq.
"No final decisions have been made," Panetta said.
Iraq has expressed a desire to maintain U.S. trainers and other aid going forward, he noted, to help them deal with security threats.
"I want to be clear that any future security relationship with Iraq will be fundamentally different from the one that we have had since 2003. The United States wants a normal, productive relationship and close strategic partnership with a sovereign Iraqi government going forward," Panetta said. "This kind of security assistance would be a means of furthering our strategic partnership with Iraq that looks to the kind of future role that can best address Iraqi security needs."
McCain urged that the United States not abandon Iraq and "not withdraw from Iraq as irresponsibly" as the Obama administration accused the the Bush government of being when the war was started.
Panetta and Mullen also warned about cutting too much from the defense budget. If Congress cannot come to an agreement on further spending cuts, an additional $500 million in defense spending would be cut.
Mullen said too harsh a cut would have a "good chance of breaking" the military.
"We are not going to solve the debt problem on the back of the Pentagon," he warned.
Panetta was equally emphatic in arguing against further cuts beyond the $350 billion the Pentagon has already committed to over the next 10 years.
"If we pulled that trigger would we be shooting ourselves in the foot," asked Sen. Lindsey Graham, R-South Carolina.
"We'd be shooting ourselves in the head," Panetta said.