ISLAMABAD, Pakistan - CIA Director Leon E. Panetta met over dinner Friday with Pakistan's spy chief and army leader for talks on how to repair ties between the two countries that were fractured by the American raid that killed Osama bin Laden, Pakistani and U.S. officials said.

Panetta's visit was his first to Pakistan since the unilateral American operation May 2 killed the al-Qaeda leader in a Pakistani army town, triggering an angry backlash by the powerful military. It is likely to be his last before he becomes the next U.S. defense secretary.

American officials have said they want to rebuild a relationship vital to their fight against al-Qaeda and their efforts to wind down the war in Afghanistan, but progress has been slow amid suspicions by some in Washington that elements within the security establishment in Islamabad had been sheltering bin Laden.

Pakistan, facing public anger over what was seen as an unacceptable violation of sovereignty, sent home most U.S. Army trainers in the country and said Thursday it no longer wanted American financial assistance.

Panetta dined with the army chief, Gen. Ashfaq Parvez Kayani, and the head of the country's main spy agency, Lt. Gen. Ahmed Shuja Pasha, after arriving Friday, said the officials, who did not give their names to discuss the high-level meeting. Panetta's relationship with both men will be key in his new role, presuming he is speedily confirmed as the next U.S. defense chief.

At the Senate panel hearing Thursday on his confirmation, Panetta said Pakistan must do more to go after extremists within its borders. He noted that after the raid that killed bin Laden, Americans asked Islamabad to "take a number of concrete steps to demonstrate cooperation and counterterrorism."

One of those steps is the formation of a joint intelligence team to track down extremist targets inside Pakistan, drawing in part from the so-called treasure trove of bin Laden records taken from his personal office during the raid. Pakistani officials say the Americans have shared some intelligence from the trove, and the Americans say the Pakistanis are providing visas for some U.S. intelligence officers to join Pakistanis on the team, but both sides say the effort is moving very slowly.

The United States wants that team to pursue a list of five high-value targets it handed to the Pakistani leadership during an earlier visit to Pakistan by U.S. Secretary of State Hillary Rodham Clinton. It was not clear how long Panetta would stay in Pakistan, though his visits are usually very short. His visit to Islamabad coincides with a trip by Afghan President Hamid Karzai that is likely to address the role Islamabad can play in negotiations with the Taliban to end the war in Afghanistan.