President Hamid Karzai has criticised Nato for failing to bring stability to Afghanistan in over a decade there.
"On the security front the entire Nato exercise was one that caused Afghanistan a lot of suffering, a lot of loss of life, and no gains because the country is not secure," he said.
He said Nato had incorrectly focused the fight on Afghan villages rather than Taliban safe havens in Pakistan.
Mr Karzai has just six months remaining in office until a successor is elected.
"I am not happy to say that there is partial security. That's not what we are seeking. What we wanted was absolute security and a clear-cut war against terrorism," Mr Karzai said of the Nato campaign.
Speaking in one of his last major interviews before stepping down, he told BBC Newsnight that his priority now is to bring peace and security to Afghanistan, including a power-sharing deal with the Taliban.
He said that his government was actively engaged in talks with the hardline Islamic group with this aim in mind:
"They are Afghans. Where the Afghan president, the Afghan government can appoint the Taliban to a government job they are welcome," he said. "But where it's the Afghan people appointing people through elections to state organs then the Taliban should come and participate in elections."
He dismissed concerns that bringing the Taliban back into government would sacrifice the tenuous gains on the status of women made in Afghanistan.
"The return of the Taliban will not undermine progress. This country needs to have peace. I am willing to stand for anything that will bring peace to Afghanistan and through that to promote the cause of the Afghan women better," he said.
"I have no doubt that there will be more Afghan young girls and women studying and getting higher education and better job opportunities. There is no doubt about that; even if the Taliban come that will not end, that will not slow down," he added.
Before the elections for Mr Karzai's successor the United States is keen to finalise a bilateral security agreement which will also formalise US-Afghan relations following the 2014 Nato troop withdrawal.
The US wants this signed by Mr Karzai, to avoid it becoming an election issue. However, the Afghan leader told Newsnight he was in no hurry to sign a pact:
"If the agreement doesn't suit us then of course they can leave. The agreement has to suit Afghanistan's interests and purposes. If it doesn't suit us and if it doesn't suit them then naturally we will go separate ways."
The US is becoming more and more pessimistic about the issue and has said it will consider a zero troops option.
Mr Karzai has had troubled relations with his Western backers in recent years for openly criticising Nato, whom he has accused of having no respect for Afghan sovereignty.
In 2009, US President Barack Obama described Mr Karzai as an unreliable and ineffective partner. However, speaking to Newsnight Mr Karzai dismissed the claim saying he was characterised in this manner "because where they want us to go along, we don't go along. They want us to keep silent when civilians are killed. We will not, we cannot".
He said that in the years immediately following the US-led invasion of Afghanistan he had had good relations with the-then President George W Bush as in "those beginning years there was not much difference of opinion between us".
"The worsening of relations began in 2005 where we saw the first incidents of civilian casualties, where we saw that the war on terror was not conducted where it should have been."
Mr Karzai said the war should have been conducted "in the sanctuaries, in the training grounds beyond Afghanistan, rather than that which the US and Nato forces were conducting operations in Afghan villages, causing harm to Afghan people."
There has also been much criticism of the Afghan government's failure to deal with corruption, which along with lack of progress on significantly improving women's rights, saw Norway cutting some its aid to the country last week.
"Our government is weak and ineffective in comparison to other governments, we've just begun," Mr Karzai said. "But the big corruption, the hundreds of millions of dollars of corruption, it was not Afghan. Now everybody knows that. It was foreign.
"The contracts, the subcontracts, the blind contracts given to people, money thrown around to buy loyalties, money thrown around to buy submissiveness of Afghan government officials, to policies and designs that the Afghans would not agree to. That was the major part of corruption," he said.