ISLAMABAD, Pakistan — When American and Pakistani agents captured Abdul Ghani Baradar, the Taliban’s operational commander, in the chaotic port city of Karachi last January, both countries hailed the arrest as a breakthrough in their often difficult partnership in fighting terrorism.

But the arrest of Mr. Baradar, the second-ranking Taliban leader after Mullah Muhammad Omar, came with a beguiling twist: both American and Pakistani officials claimed that Mr. Baradar’s capture had been a lucky break. It was only days later, the officials said, that they finally figured out who they had.

Now, seven months later, Pakistani officials are telling a very different story. They say they set out to capture Mr. Baradar, and used the C.I.A. to help them do it, because they wanted to shut down secret peace talks that Mr. Baradar had been conducting with the Afghan government that excluded Pakistan, the Taliban’s longtime backer.

In the weeks after Mr. Baradar’s capture, Pakistani security officials detained as many as 23 Taliban leaders, many of whom had been enjoying the protection of the Pakistani government for years. The talks came to an end.