Afghan President Hamid Karzai sharply criticized the United States in an exclusive interview with NBC News on Thursday, blaming American and NATO forces for some of the growing insecurity in his country.

"Part of the insecurity is coming to us from the structures that NATO and America created in Afghanistan," Karzai said during a one-on-one interview at the presidential palace. However, he also acknowledged that much of the country's violence was caused by insurgent groups.

The Taliban are regaining land and power lost after they were toppled by U.S.-backed forces in 2001. Meanwhile, Karzai has gone from being a favorite of Washington under the presidency of George W. Bush, to a thorn in the White House's side with his criticism of American night raids and mounting civilian casualties at the hands of NATO troops. Many in Washington have also grown weary of Karzai, viewing him as ineffective and presiding over a deeply corrupt government.

Karzai, who is serving his second five-year term, also told NBC News that he had sent a letter to President Barack Obama saying that Afghanistan would not sign any new security agreements with the United States until hundreds of prisoners held in U.S. custody were transferred to Afghan authorities.

His criticism of the United States, Afghanistan's most important ally, has come after the start of complex bilateral talks on a security pact on the role the United States would play after most of its troops are withdrawn by the end of 2014.

Karzai said the inmates in American detention in Afghanistan were being held in breach of an agreement he and Obama signed in March and must be handed over immediately.

 "We signed the strategic partnership agreement with the expectation and the hope ... the nature of the United States' activities in Afghanistan will change," Karzai said.  But American behavior had not changed, he said, adding that terrorism would not be defeated "by attacking Afghan villages and Afghan homes."

The dispute between the two countries centers around Bagram Air Base and a nearby detention facility, which have long been seen as a symbol of American impunity and disrespect by many Afghans.

 "I have written to President Obama that the Afghan people will not allow its government to enter into a security agreement, while the United States continues to violate Afghan sovereignty and Afghan loss," he said.

During the interview, Karzai also said that he didn't think al-Qaida "has a presence in Afghanistan."

He added: "I don’t even know if al-Qaida exists as an organization as it is being spoken about. So all we know is that we have insecurity."

The United States led the invasion in the wake of the Sept. 11, 2001, attacks on the United States to topple the Taliban, which was harboring al-Qaida and its then-leader, Osama bin Laden. While weakened, especially after the death of bin Laden at the hands of U.S. special forces in Pakistan in 2011, al-Qaida is still thought to have strong links with the Taliban and other Afghan insurgents.