Like just about everything else in Pakistan, the terrorist attacks on the United States on 11 September 2001 radically changed Pakistan's international profile and its foreign policy. Long a supporter of the Taliban government in neighboring Afghanistan—and one of only three countries in the world to recognize its legitimacy (along with the United Arab Emirates and Saudi Arabia)—Musharraf quickly altered his country's support for the Islamic regime. He offered his full support to the United States and its military campaign against the Taliban regime and the terrorist cell it supported. Soon after declaring his support for the United States, Musharraf fired the pro-Taliban head of the traditionally powerful Inter-Services Intelligence (ISI) agency and made several other changes in personnel as well. He also allowed the United States to use Pakistan for air bases and in 2002, after the Taliban had been defeated in Afghanistan, there were media reports that he had secretly consented to allowing U.S. and British military forces to operate on Pakistani soil as they searched for remnants of the al-Qaeda terrorist cell that had launched the attacks on the United States. In appreciation of Musharraf's cooperation, the United States rescheduled billions of dollars of debt, and the International Monetary Fund (IMF) approved a series of badly needed loans and also agreed to massive debt reschedulings.
Relations with India, unlike those with the United States, have not improved at all, and have in fact deteriorated markedly since the terrorist attacks on the United States. During his years in the military, Musharraf was considered a hawk on the disputed territory of Jammu and Kashmir, claimed by both India and Pakistan and the source of two wars between the countries. Musharraf is widely credited, in fact, with having planned a 1999 invasion of the India-held portion of the territory. The invasion, while quickly repelled, triggered a massive buildup of forces along the Line of Control, the de facto border between the areas claimed by the two nations.
In December 2001, Islamic militants staged an armed attack on India's parliament building, killing nine people in addition to the five attackers. India blamed Pakistan and began massing troops on its border. Pakistan responded with its own military buildup, though it denied having any responsibility for the attack. In the ensuing months, India suffered several other attacks, both in Kashmir and in India itself and by mid-2002 one million troops faced each other across the countries' shared border. Most of the troops were withdrawn by October, but tensions remained. At the end of January 2003, both India and Pakistan expelled top-level diplomats from the other's country, accusing them of spying. Throughout 2002 and into 2003, the two countries test-fired ballistic missiles capable of carrying nuclear weapons.