Since September 11, 2001, Pakistan has pursued seemingly incongruous courses of action in Afghanistan. It has participated in the U.S. and international intervention in Afghanistan at the same time as it has permitted much of the Afghan Taliban's political leadership and many of its military commanders to visit or reside in Pakistani urban centers. This incongruence is all the more puzzling in light of the expansion of indiscriminate and costly violence directed against Islamabad by Pakistani groups affiliated with the Afghan Taliban. Pakistan's policy is the result not only of its enduring rivalry with India but also of historically rooted domestic imbalances and antagonistic relations with successive governments in Afghanistan. Three critical features of the Pakistani political system—the militarized nature of foreign policy making, ties between military institutions and Islamist networks, and the more recent rise of grassroots violence—have contributed to Pakistan's accommodation of the Afghan Taliban. Additionally, mutual suspicion surrounding the contentious Afghanistan-Pakistan border and Islamabad's long record of interference in Afghan politics have continued to divide Kabul and Islamabad, diminishing the prospect of cooperation between the two capitals. These determinants of Pakistan's foreign policy behavior reveal the prospects of and obstacles to resolving the numerous issues of contention that characterize the Afghanistan-Pakistan relationship today.