WASHINGTON (AFP) - Pakistans former leader Pervez Musharraf warned Wednesday that his countrys spies will need to take counter-measures in Afghanistan if US troops leave it unstable or it becomes too close to India. On a visit to Washington, Musharraf described relations between the United States and Pakistan as terrible but defended the Inter-Services Intelligence (ISI) agency that US officials have accused of supporting extremists. Musharraf, who has lived in exile since stepping down in 2008, insisted that his countrys historic rival India was working through intelligence, military and diplomatic contacts to turn Afghanistan against Pakistan. Since our independence, Afghanistan always has been anti-Pakistan because the Soviet Union and India have very good relations in Afghanistan, Musharraf said at the Carnegie Endowment for International Peace. We must not allow this to continue, he said. We must not begrudge if Pakistan orders ISI to take counter-measures to protect its own interests. Musharraf said Afghanistan could plunge into conflict along ethnic lines after 2014, when the United States plans to withdraw its combat troops from Afghanistan, ending more than a decade of war. Are you leaving a stable Afghanistan or an unstable Afghanistan? Because based on that, I in Pakistan will have to take my own counter-measures, Musharraf said. The adverse impact will be on Pakistan, so any leader in Pakistan must think of securing Pakistans interests, he added. Pakistan helped create the Taliban and was the main supporter of the hardline movements former regime. Musharraf, who seized power in a 1999 coup, switched sides and allied with the United States after the September 11, 2001 attacks. Relations between Washington and Islamabad plummeted in May when the United States launched a secret raid that killed the worlds most wanted man Osama bin Laden in Pakistans military city of Abbottabad. Since then, senior US officials have publicly accused the ISI of closely working with the extremist Haqqani network which has carried out attacks on US targets, including Washingtons embassy in Kabul.