Afghan President Hamid Karzai’s top advisers said Wednesday that the rise in insider attacks on NATO troops recently is the product of foreign spy agencies infiltrating Afghanistan’s security forces, though they also pinned some blame on what they called “inhumane acts” by U.S. troops and weaknesses in the Afghan vetting process.

After months of investigating, members of Karzai’s National Security Council have concluded that both Pakistani and Iranian intelligence organizations are recruiting young Afghans to enlist in the army and police with the intention of targeting Western service members, the officials said, suggesting that the ultimate aim is to destabilize Afghanistan’s forces.

As those neighboring countries become concerned about the growing strength of the Afghan army and police, Karzai officials concluded, they have stepped up attempts at infiltration.

“The National Security Council has enough evidence to prove that Afghans are being used and brainwashed by these foreign agencies,” said Aymal Faizi, a spokesman for the president. “They see this as a way of attacking the buildup of the Afghan National Security Forces . . . proving that they are weak and unable to protect the country.”

The classified evidence that supports these conclusions is vast, Faizi said, including “documents, telephone calls, pictures and audio that show direct contact between these individuals and foreign spy agencies.”

Although members of Karzai’s administration referred publicly only to the spy agencies of “foreign countries,” officials confirmed that Pakistan and Iran were by far the biggest concerns.

After being briefed on the National Security Council’s investigation, Karzai met with Marine Corps Gen. John R. Allen, the top U.S. commander in Afghanistan, to inform him of the Afghan administration’s findings and how officials plan to respond.

Karzai’s top national security advisers acknowledged that the vetting protocol for new army and police recruits has not been properly implemented over the past decade because the country’s security forces were under Western pressure to expand rapidly.

“Because of the speedy process, there have been problems and weakness in the system,” Faizi said.

To address those issues, the spokesman said, Karzai has pledged to follow his advisers’ recommendation that every recruit be vouched for by a reliable source, particularly those with family connections across the border. The president also suggested that counterintelligence efforts be strengthened within the Afghan security forces and that “psychological operations” be used to render soldiers and police less amenable to enemy propaganda.

Even before the National Security Council’s guidance to Karzai on Wednesday, Afghan army leaders had outlined a broad expansion of counterintelligence measures designed to spy on their own soldiers.

Over the past few months, Afghan defense officials have told soldiers that they must move their families back from Pakistan and Iran or else they will lose their jobs. But officials acknowledge that severing cross-border ties will not be easy. More than 2 million Afghans reside in Pakistan, and more than 1 million are in Iran.

Although Karzai’s advisers attributed the recent rise in insider attacks to foreign spies, they said the incidents also represented a response to several U.S. missteps, which have served as a rallying cry for the insurgency.

“The mistreatment and inhumane practices by foreign troops in Afghanistan, . . . like the burning of the Koran and the photos of soldiers urinating on dead bodies, also had an impact on the number of attacks,” Faizi said.