"In President Karzai's times, yes, indeed, he was damaging Pakistan and, therefore, we were working against his interest. Obviously, we had to protect our own interest," the former military ruler said in an interview published on Friday.
Spies in Pakistan's Inter Services Intelligence (ISI) had given birth to the Taliban after 2001 because the Karzai- government had an overwhelming number of non-Pashtuns and officials who were said to favour India, Musharraf said.
"Obviously, we were looking for some groups to counter this Indian action against Pakistan.
"That is where the intelligence work comes in. Intelligence being in contact with Taliban groups. Definitely they were in contact, and they should be," the 71-year-old former dictator said.
Musharraf - who suffered a setback in his political career as he has been ensnared by a series of legal cases, including one murder and one treason charge - admitted that when he was in power, Pakistan sought to undermine Karzai's government because the former Afghan premier had "helped India stab Pakistan in the back".
Karzai infuriated both Musharraf and his successor Ashfaq Kayani by spurning offers to help train Afghanistan's embryonic army. Instead, Karzai sent cadets to India, where Musharraf believes they were "indoctrinated" against Pakistan.
During his first few months in office, Ashraf Ghani, who took reigns of the war-torn country from Karzai last year, has sought to improve ties with Pakistan. Ghani not only called off a weapons deal with India, but also sent  troops to fight against anti-Pakistan militant groups in eastern Afghanistan.
However, the former army chief was of the view that the time had come to fully cooperate with Ghani who he believed was "the last hope for peace in the region".
"But now President Ashraf Ghani has come and he is trying to restore balance in Afghanistan. We must totally cooperate with him," Musharraf said.
Musharraf also made repeated hints that the nominal western ally assisted both NATO forces in Afghanistan and the Taliban they were fighting against in a bid to counter the perceived influence of India.
"Pakistan had its own proxies, India had its proxies, which is unhealthy. I do admit this, it is most unhealthy. It is not in favour of Afghanistan, or Pakistan or India. It must stop.
"The RAW of India, the ISI of Pakistan have always been fighting against each other since our independence. That is how it continued, it continues now also. It must stop, but it can only stop when leaderships on both sides show the will to resolve disputes and stop confrontation in favour of compromise and accommodation," he said.

Latest News from World News Desk