A transit trade deal reached by the two neighbors Sunday is the latest milestone in a rapidly changing relationship long characterized by distrust and ill will -- and one that could have broad consequences for how they confront their shared Taliban insurgency. Officials from both countries now speak with marked optimism about the prospects for collaboration.

"It's a paradigm shift," Sadiq said in an interview last week. "We see a lot more confidence in each other, a lot more cooperation in very sensitive fields."

"We now have a better relationship with Pakistan," a senior Afghan official said. "There is a new willingness on both sides that we should resolve the [Taliban] problem. We are both suffering from this menace."

Even before Pakistan agreed to allow Afghan trucks to transport goods through its country to the Indian border, a potential boon for Afghan agricultural exports, several signs pointed to a thaw in the rivalry between the wary neighbors, who share one of the world's most volatile borders.

Critics of Afghan President Hamid Karzai remain skeptical, however, that Pakistan will commit to destroying elements of the Taliban network, which senior U.S. officials think is supported by Pakistan's Inter-Services Intelligence agency to some degree.

"We know that Mr. Karzai is in a very dangerous game that he cannot win. It's impossible," said Saleh Mohammad Registani, an Afghan lawmaker. "This game is controlled by Pakistan."

Strategic partnership

Pakistani officials trace the improvement in ties to 2008, after the departure of President Pervez Musharraf, who had a troubled relationship with Karzai. The next year, Pakistan stayed neutral during the political crisis that followed Afghanistan's fraud-marred presidential election, Pakistani officials said. Karzai blamed the West for undermining his chances.

Other officials familiar with Karzai's thinking say he also has lost faith in NATO forces' ability to defeat the insurgency and has turned to Pakistan to help broker a deal to end the conflict.

Last year, Karzai agreed to allow Afghan students to accept scholarships to study in Pakistan -- a move that will push the number of Afghan graduate students in Pakistan from about 6,000 to 8,000, Sadiq said. Three weeks ago, Karzai agreed to send Afghan military officers across the border to be trained by the Pakistani military. Qureshi, Pakistan's foreign minister, told reporters in Kabul that the first batch of 20 Afghan officers would leave for Pakistan soon.