Insurgents and terrorists in Yemen, Somalia and beyond owe a a great deal of thanks to the Afghan National Army and Police. Those ostensible U.S. allies just gave U.S. enemies a new strategy for attacking a weak link in the "shadow wars" that define the future of U.S. counterterrorism: Infiltrate the local security forces and kill the American mentors.

Afghan troops have killed over 40 of their U.S. and NATO mentors this year alone. The assaults prompted the NATO military command, known as ISAF, to . From now on, a two-star general will decide if they can proceed, not captains or lieutenants on the ground.

The purpose behind the so-called "insider attacks" is "to erode trust" between the Americans and the Afghans, according to Australian Brig. Gen. Roger Noble, a top operations officer at ISAF headquarters. And while Noble insisted the trust endures, the new layer of bureaucracy separating Americans and Afghans suggests the trust is most certainly eroded.

"I trust the [Afghans] I speak to," he told Pentagon reporters Wednesday, "but I always take a weapon."

That would be bad enough for the Afghanistan war, since Obama administration's entire strategy to wind down the war depends on preparing Afghan soldiers and police to take over. But it's got implications for the other wars the U.S. is fighting – in Yemen, and in East Africa.

Those wars are known colloquially as "shadow wars," for a few reasons. Not only are they undeclared wars, they depend on concealing the U.S. role in them. One method of concealment is to use stealthy forces like elite commandos or tools that require a small logistical footprint, like drones. Another method is to use proxy forces to wage them. In Yemen, for instance, the U.S. is training the local forces to fight al-Qaida in its stead, and they come bearing cash and weapons.

Now imagine yourself as a Yemeni insurgent. You've seen the government forces reclaim territory from you. So perhaps instead of fighting them, a smarter strategy is to join them – to go through training, in preparation for the moment when, perhaps, you can get close enough to the Americans to open fire or detonate a bomb.

To be fair, it's not immediately clear how many of the insider attacks are part of an insurgent strategy – and how many are the result of friction between local forces. Marine Gen. John Allen, the ISAF commander, thinks only a quarter of attacks are pre-planned. And insider attacks outside of Afghanistan will probably be less dramatic. Not only are there more Americans to target in Afghanistan than in any other warzone, but those American troops live among the local forces, providing easier targets of opportunity. What's more, the U.S. troops training shadow-war militaries are usually special operations forces, who probably prove more difficult to assault. Those special operations forces also have long, long experience training foreign allies, whether in Colombia, Nicaragua, the Philippines or Yemen.

Those training missions have become even more important, as the shadow wars grow. "By, with and through" is a watchword sweeping through the U.S. military to underscore the importance of getting foreign proxies ready to take over the counterterrorism fight. "In Yemen, we're essentially acting as a stopgap until Yemenis can take full responsibility," Katherine Zimmerman, a defense wonk at the American Enterprise Institute, recently told Danger Room. "We've got a very willing partner in Yemen. We're working on making it an able partner." With the American public sick of war, those proxies are increasingly crucial.

And it's not even just counterterrorism. So-called "Security Force Assistance" is a major preoccupation for the U.S. Army in general as its involvement in Afghanistan winds down. When Gen. Martin Dempsey was asked in 2011 what the future of the Army was, he said it involved mentoring foreign partner militaries so the U.S. doesn't have to intervene during crises, bolstering weak armies. Dempsey, of course, is now America's top military officer.

What's more, the effect of insider attacks, whether or they actually result in dead Americans, is disproportionate to the effort required to pull them off. It "strikes at the heart of our resolve," Noble lamented. On a tactical level, they compel commanders to "reduce our profile" out in the field. But there's a strategic impact that can't be overlooked – particularly when considering that successful insurgent strategies exploit weaknesses in their larger, more professional adversaries.

"Probably the bigger impact is back where you are – the perception at home about what does it mean when your friends are shooting you," Noble said. "That's a risk at the strategic level."

It's proven difficult to dislodge the U.S. from its official wars. But shadow wars may be different. Since they involve few U.S. troops and minimal political commitment, they may not command the same popular support as the Iraq or Afghanistan wars did. Last week's attacks in Egypt and Libya on U.S. diplomatic installations show how rapidly anger with an ostensible ally can sway public opinion: already, legislators are talking about cutting off U.S. aid.

Dislodging the U.S. from its key foreign counterterrorism allies may not have to depend on homemade bombs or small arms fire anymore. In the future, it might start at a foreign recruiting station.