Pakistan's army and military spy agency trained al-Qaeda and then maintained links with the militants afterwards, Imran Khan has said.
Pakistan's prime minister said his country had then made a major mistake siding with America during the war on terror after the 9/11 attacks.
The decision had cost 60,000 Pakistani lives as the country battled Islamist militancy and Pakistan would have been better staying neutral.
Mr Khan's comments at a New York think tank came ahead of his speech at the United Nations general assembly this week where he is expected to press the case for international action against India over Kashmir. He has also held meetings with Donald Trump trying to get the American president to restart talks with the Taliban movement in Afghanistan.
Asked at the Council for Foreign Relations about how Osama bin Laden had managed to stay in Pakistan undiscovered, Mr Khan said: “The Pakistani Army, ISI [military spy agency], trained al-Qaeda and all these troops to fight in Afghanistan.
“There were always links between—there had to be links, because they trained them."
He said the links were “probably at lower levels”, and he did not believe military chiefs had known of Bin Laden's presence.
Pakistan PM:— Miraqa Popal (@MiraqaPopal) September 24, 2019
"The Pakistani #Army, ISI, trained al-Qaida and all these troops to fight in #Afghanistan. There were always links between—there had to be links, because they trained them." pic.twitter.com/BZ61P4tgxu
Mr Khan's comments may anger the military. Pakistan's security apparatus has in the past angrily rejected politicians linking it to militancy. Nawaz Sharif, the former prime minister, faced treason charges last year after an interview where he suggested the Pakistani state played a role in the 2008 Mumbai attack that killed 166 people.
Mr Khan said that after the 9/11 attacks, Pakistan had done a 180 degree turn against former militants, to side with America.
“I opposed this from day one,” Mr Khan said.
“I said we had first trained these guys to fight jihad and it was a great idea, and now we are telling the same groups it’s terrorism. So we should at least have stayed neutral. Pakistan, by joining the US after 9/11, committed one of the biggest blunders.”
Mr Khan also said he believed the Taliban had changed since they were ousted in 2001 and were willing to make peace
He said: “Taliban realise that they cannot control the whole of Afghanistan. The Afghan government knows that they cannot - you know, there needs to be some sort of a peace deal. There has to be a political settlement.”