WASHINGTON — The recent capture of the Afghan Taliban’s second in command seemed to signal a turning point in Pakistan, an indication that its intelligence agency had gone from providing help to cracking down on the militant Islamist group.

But U.S. officials now believe that even as Pakistani security forces worked with American counterparts to detain Mullah Abdul Ghani Baradar and other insurgents, the country’s Inter-Services Intelligence directorate, or ISI, quietly freed at least two senior Afghan Taliban figures it had captured on its own.

U.S. military and intelligence officials said the releases, detected by spy agencies but not publicly disclosed, are evidence that parts of Pakistan’s security establishment continue to support the Afghan Taliban. This assistance underscores how complicated the CIA-ISI relationship remains at a time when the United States and Pakistan are both battling insurgencies that straddle the Afghanistan border and are increasingly anxious about how the war in that country will end.

The officials declined to disclose the names of the Taliban figures who were released, citing the secrecy surrounding U.S. monitoring of the ISI. But officials said they were high-ranking Taliban members and would have been recognized as insurgents the United States would want in custody.

The capture of Baradar was “positive, any way you slice it,” said a U.S. counterterrorism official. “But it doesn’t mean they’ve cut ties at every level to each and every group.” Initial reports said the arrest had occurred in February, but U.S. officials say that it took place in late January.

U.S. officials believe that Pakistan continues to pursue a hedging strategy in seeking to maintain relationships with an array of entities — including the U.S. and Afghan governments, as well as insurgent networks — struggling to shape the outcome in Afghanistan, even as it aggressively battles the Pakistani branch of the Taliban.

The ISI wants “to be able to resort to the hard power option of supporting groups that can take Kabul” if the United States suddenly leaves, said a U.S. military adviser briefed on the matter. The ISI’s relationship with the Afghan Taliban was forged under similar circumstances in the 1990s, when the spy service backed the fledgling Islamist movement as a solution to the chaos that followed the Soviet withdrawal.

In interviews in Islamabad, Pakistani intelligence officials said the ISI was committed to dismantling insurgent groups, denying that any Taliban operatives had been captured and released.

U.S. officials concur that that the collaboration between the CIA and ISI has improved substantially but said they see ongoing signs that some ISI operatives are providing sanctuary and other assistance to factions of the Taliban when their CIA counterparts are not around.

“They did in fact capture and release a couple,” said a U.S. military official involved in discussions with Pakistan, adding that the ISI’s decision to do so “speaks to how hard it is to change your DNA.”

The U.S. military adviser said the senior Taliban figurers were detained in Baluchistan, a province that encompasses the sprawling city of Quetta, where Mullah Muhammad Omar and other Afghan Taliban leaders are believed to have taken refuge after being expelled from Afghanistan after the U.S. invasion in 2001.

The releases took place in January and February, officials said, around the same time that the ISI conducted a series of raids that led to the reported capture of Baradar and four other senior Taliban figures. Among them were so-called “shadow governors” who preside unofficially over swaths of territory in Afghanistan.

U.S. officials said there are new questions about whether one of those arrests occurred. Pakistan security officials said in February that Maulvi Abdul Kabir, thought by some to be a member of the Taliban’s “Quetta Shura” leadership core, had been captured in the northwest Nowshera district. But U.S. officials said there has been no subsequent evidence of the arrest, and now believe that Kabir was never detained.

Pakistan has been pressured repeatedly to sever its ties to the Taliban since the Sept. 11, 2001, attacks. As recently as November, President Obama sent a letter to Pakistani President Asif Ali Zardari warning that the government’s use of insurgent groups to advance its interests “cannot continue.”