A recent series of assassination attempts on high-level officials here is the result of a growing and deadly alliance between Pakistani extremists and second-rung al Qaeda operatives from Arab countries and Central Asia who use the border area with Afghanistan as a refuge, according to senior Pakistani intelligence sources.

The development is a disquieting one, foreign diplomats said, because it suggests that Pakistan's security services may be losing control over home-grown militants they once embraced as allies, first in the struggle against the Soviets in Afghanistan and more recently against Indian forces in Kashmir.

An attack on Lt. Gen. Ahsan Saleem Hayat, a top military commander, on June 10 was conducted by Pakistani assailants who later confessed they had been trained in small arms, explosives and conducting ambushes at an al Qaeda camp in Pakistan's rugged tribal region of South Waziristan, near the Afghan border, according to two senior intelligence officials.

The gunmen identified their instructors as Uzbeks and Arabs.

The Pakistani extremists, disguised in military-style uniforms, attacked Hayat as they waited in a stolen van in the port city of Karachi near a bridge frequented by military officials, then opened up with machine guns on his motorcade.

Hayat survived the carefully planned ambush, but 11 others were killed, including his driver. The assailants were quickly identified and rounded up, traced through a cell phone left at the scene, authorities said.

Pakistani officials said they believed that foreign al Qaeda operatives working with Pakistani militants were also behind two attempts to kill Gen. Pervez Musharraf, Pakistan's president, in December.

The same combination, they said, may have carried out the July 30 assassination attempt against Shaukat Aziz, then the finance minister, who became prime minister on Saturday.

"For a foreigner to operate in Pakistan has become more and more difficult, so obviously their effort is to use local operatives," said one of the senior intelligence officials, who spoke on condition that neither he nor his organization be identified.

On Monday, government troops killed four foreign fighters and wounded several others in a shootout in a remote tribal section on the Afghan border, authorities said. On Aug. 21, authorities announced the arrest of up to 10 al Qaeda suspects, including Pakistanis and two Egyptians, after breaking up what they said was a plot to launch attacks against the U.S. Embassy and Musharraf's residence, among other targets.

The decision to apply stronger pressure on militants poses a delicate challenge for Musharraf, who is eager to confront the domestic terrorist threat and has recently won international praise following a series of high-profile al Qaeda arrests in Pakistan in June and July.

At the same time, Musharraf is reluctant to challenge extremist groups he still regards as potential levers in the conflict with India over control of Kashmir, even though the groups theoretically have been banned, analysts said.

In an interview with a Pakistani newspaper this month, Musharraf said the groups would not "pack up" until India and Pakistan reached a settlement on Kashmir, which Pakistan regards as the key issue in peace negotiations between the nuclear-armed neighbors.

"What he's saying is, 'If there's movement on Kashmir, it will strengthen my hand to move even more strongly against these people,' " the senior intelligence official said.

Musharraf's allies are losing patience with that argument. During a trip to the region last month, Deputy Secretary of State Richard Armitage publicly called on Pakistan to act more forcefully against the homegrown groups. One foreign diplomat cited reports that fighters from Lashkar-e-Taiba, one of Pakistan's best known banned militant organizations, had traveled to Iraq in recent months to join other foreigners battling U.S. and Iraqi government forces.

"We have received these reports, and we take them very seriously because we do know there were efforts to take some Pakistanis into Iraq," said the senior intelligence official. But the official said it was unclear whether the efforts succeeded.

The official also asserted that Musharraf had limited room to maneuver against domestic extremists, given the depth of public anger over U.S. policy in the Middle East. "I think the time has come for others to do more for Pakistan than for Pakistan to do more," said the official. "I think our commitment on terrorism is absolutely unparalleled, and it needs to be acknowledged."

On Dec. 25, Musharraf's high-wire act nearly cost him his life when two suicide bombers drove explosives-laden vehicles into his motorcade in the city of Rawalpindi, where he lives, killing 19 people but leaving the president unharmed. One of the bombers was later identified as a member of a breakaway faction of Jaish-e-Mohammed, one of the main militant groups battling Indian forces in Kashmir. The group was founded with the government's blessing in 2000 by Masood Azhar, a radical cleric.

"Jihadists like Masood Azhar were then the natural allies of Musharraf, hence the ultimate freedom to propagate and recruit jihadis under state patronage," said a former army chief of staff who spoke on condition of anonymity. Azhar may now oppose Musharraf, "but there will be a price," the former official said.

Jaish-e-Mohammed has also been linked to the attack on Aziz, the new prime minister. Investigators have identified the prime suspect in the case as Qari Ahsan, who lived in the same southern Punjab town as Azhar and was considered one of his top lieutenants, intelligence officials said. Azhar has disappeared from view; a senior intelligence official described him as a fugitive.

But the official said it would be a mistake to conclude that Jaish-e-Mohammed and other such organizations had actively turned against the government. "The leadership was under pressure from the government, so you find everyone splintering into small cells acting on their own," he explained.

The official also asserted that as a consequence of Pakistan's counterterrorism efforts, including a series of army operations in South Waziristan this year, the ability of al Qaeda -- and especially its senior leaders, Osama bin Laden and Ayman Zawahri -- to direct attacks had been "very severely curtailed."

At the same time, the official said, "there is probably a second or third tier that has started asserting itself operationally."

A leading example is a Libyan citizen, Abu Faraj Libbi, whom Pakistani authorities accuse of coordinating the December attempts on Musharraf's life. The senior official said it was "quite likely" that Libbi also had a hand in the attempt on Aziz, whose driver was killed in the bombing, although other investigators described the connection as speculative. The official said that Libbi was believed to be directing terrorist operations both in Pakistan and elsewhere from a hideout in South Waziristan.

Pakistani newspapers have run ads offering rewards of up to $345,000 each for information leading to the capture of Libbi and five Pakistanis, including Ahsan, the former Jaish-e-Mohammed lieutenant sought in connection with last month's attempt on Aziz.

The June attack on Hayat, who commands one of Pakistan's nine army corps, has been blamed on a previously unknown group called Jundullah. Its alleged leader, Ataur Rehman, holds a master's degree in statistics from Karachi University and fought with the Taliban when it enjoyed the backing of Pakistan's government during the Afghan civil war of the 1990s, investigators said.

Although officials have not specifically linked that episode to the Libyan, they said that two of the gunmen had admitted spending four weeks under al Qaeda's tutelage at a mud-walled compound in the Shakai Valley of South Waziristan. The compound was one of several destroyed in a major military assault in May.

Khan reported from Karachi.

Police officers sealed off an area in Karachi in June after the attempted assassination of a top Pakistani commander.Paramilitary soldiers guarded one of the vehicles in the general's motorcade after it came under fire. Eleven people were killed in the Karachi incident.