WASHINGTON — President Obama’s national security adviser met secretly in the Persian Gulf last weekend with Pakistan’s top military officer to deliver a tough message: rein in the Haqqani network, a deadly insurgent group in Afghanistan that the United States says has close ties to Pakistan’s main spy agency.

Just a few weeks before, however, American officials held a secret meeting with leaders of the Haqqani network. But then, the purpose was to explore ever so delicately how the group, or at least some of its members, might join talks to end the war in Afghanistan.

The two meetings, held just over a month apart, underscore the Obama administration’s complicated and seemingly contradictory policies in Afghanistan and Pakistan as it struggles to end the decade-old conflict in Afghanistan and salvage a deteriorating security relationship with Pakistan.

The talks with the Haqqani network, which were brokered by the Pakistani spy agency, illustrate the administration’s recognition that military strikes alone will not end the fighting with the Taliban, the Haqqanis and other insurgents in Afghanistan. But the discussions, which one official described as “very preliminary,” yielded no results. And within weeks, senior American officials were blaming Haqqani fighters for a truck bombing at a NATO outpost south of Kabul on Sept. 10, which killed at least five people and wounded 77 coalition soldiers, and a 20-hour assault on the United States Embassy in Ka bul.