Last December 24th an Afghan policewoman shot dead a NATO police advisor. An investigation of the incident revealed that the shooter was not working for the Taliban but was instead an Iranian in the country illegally and had obtained her job in the police via corruption (her Afghan husband). The woman would never have been hired legitimately as she was mentally unstable. Such corruption is common in Afghanistan, where everything has a price. The biggest obstacle to peace and economic growth in Afghanistan is the corruption, Afghan and Western attempts to deal with it have been frustrated by local resistance to change.
In 2012 there were 61 such fatal attacks by "friendly" Afghans against foreign troops, compared to 35 in 2011. There have been more of these deaths in the last two years than in all the previous years (back to 2001). These “green-on-blue” attacks caused 15 percent of foreign troop deaths last year and six percent in 2011. For the Taliban the problem is that overall foreign troop deaths have been declining for the last two years (down 20 percent in 2011 and 28 percent last year). Moreover, most of these “green-on-blue” deaths do not appear to be the result of any Taliban activity.
This is largely because the main problem with Afghan soldiers is that many have serious anger management issues and the size of the Afghan security forces have expanded enormously in the last few years. Afghan commanders believe that more careful screening will eliminate the less stable troops, as well as traitors. There is a lot of doubt, although foreign troops are now well aware that they must be careful about getting into an argument with an armed Afghan.
Most of the incidents where Afghan police or soldiers shoot NATO personnel are not about Taliban infiltration but rather a recent argument, often over something trivial (at least to the Westerners). An Afghan will often open fire on armed NATO troops, even though it's obvious that this is a suicidal action. The Taliban often take credit for these incidents, when it was just another case of an Afghan soldier losing control. Afghan troops often do this with other Afghans but these incidents rarely make the headlines in Afghanistan or outside the country.
Afghanistan is a very violent place, which fascinates, perplexes, and frustrates foreigners. The violence is also at the root of the many social problems that keep Afghans poor, ignorant, and terrorized. It starts in childhood and never stops. Westerners who get to know the place are appalled to discover how violent Afghanistan is. It's not just men killing each other over minor matters but violence against women and children. Western doctors and nurses working in clinics see a lot of this, much more so than they would back home. The violence continues into adulthood. For example, it was concluded that the killing of president Hamid Karzai's brother (Ahmad, then governor of Kandahar province) in 2011, was not the result of a Taliban assassination plot. The killer was a close personal aide of Ahmad Karzai, who had screwed up and discovered that Ahmad was going to punish him in such a way that everyone in the household, and beyond, would know the details of the error and the punishment. This would mean public disgrace, and rather than let that happen the man shot his boss to death and was then killed by Ahmad's bodyguards. This, by Afghan standards, was the honorable way to go. For those with few possessions and little education "honor" looms larger in the scheme of things.
This violence makes it more difficult for Afghan troops to receive advice, training, or services (intelligence, medical, logistic) from the foreigners. Worse yet, the foreign troops are more wary when among their Afghan allies, creating the risk that there will be friendly fire going in the other direction, as NATO troops open fire at threats they formerly dismissed. So the Afghan military is going to screen troops, and new recruits, more thoroughly. Officers and NCOs are now supposed to report troops they believe may be unstable or working with the enemy. All this may not be enough because the problem is not so much with individuals as it is with Afghan culture.