ISLAMABAD, Pakistan – Afghanistan and Pakistan are talking about how to make peace with insurgents fighting U.S. troops in Afghanistan, including one faction considered the coalition forces’ most lethal foe, according to Pakistani and U.S. officials.

The discussions reflect the beginnings of a thaw in relations between Kabul and Islamabad, which are increasingly focused on shaping the aftermath of what they fear could be a more abrupt withdrawal of U.S. troops than is now anticipated.

But one element of the effort — outreach by Pakistan to the militia headed by the young commander Sirajuddin Haqqani — faces opposition from U.S. officials, who consider the al-Qaida-linked group too brutal to be tolerated.

At Pakistan’s suggestion, Gen. Ahmed Shuja Pasha, the chief of Pakistan’s powerful intelligence agency, made an unprecedented trip last month to Kabul to discuss with Afghan President Hamid Karzai a wide range of possible cooperation, including mediating with Pakistan-based insurgents.

Several weeks ago, Pasha and Pakistan’s army chief of staff, Gen. Ashfaq Kiyani, returned to continue the discussion. There is no agreement between the two nations, but a Pakistani security official said the outreach to insurgents is “not a problem.”

The previously undisclosed visits came as the United States, gradually warming to the idea of reconciliation with insurgents, encourages improved relations between the two governments, which have long viewed each other with suspicion. But Obama administration officials have cautioned Afghanistan and Pakistan that they will not support talks with Haqqani’s militia.

The talks are a reminder that Afghanistan and Pakistan each has an agenda independent of its relationship with the United States and that they may draw different lines in deciding how and when to make peace.

Haqqani’s adoption in recent years of suicide bombings and complex urban assaults has made his faction, based in Pakistan’s North Waziristan tribal area, a top threat to military gains and political stability in Afghanistan.

The CIA and U.S. military think that Pakistan’s Inter-Services Intelligence agency retains links with, and possibly assists, Haqqani, and they have pressed Pakistan to target his sanctuaries.

In a recent meeting with Pakistan’s army chief, U.S. Gen. David Petraeus, the head of Central Command; Joint Chiefs of Staff Chairman Mike Mullen; and Gen. Stanley McChrystal, the U.S. and NATO commander in Afghanistan, presented evidence that deadly attacks in Afghanistan last month on a NATO convoy and the main coalition air base were commanded and controlled by Haqqani from Miram Shah, the largest city in North Waziristan.

National security adviser James Jones has carried the same message of caution on Haqqani in recent visits to Pakistan.