What lies behind Afghanistan's insider attacks?
Deadly insider attacks have become one of the defining features of the later phase of the conflict in Afghanistan.
The killings have undermined Nato's ambition to fight "shoulder to shoulder", against the Taliban.
But what lies behind these incidents? BBC News examines the complex web of factors that lead Afghan soldiers to turn their guns on their allies.
TALIBAN INFILTRATION AND DEFECTIONS
It is difficult to develop a clear picture of why this happens as few "rogue" soldiers are taken alive - most were shot dead and several have escaped.
Afghan 'green-on-blue' attacks
- 2007 - 2 attacks, 2 Isaf soldiers dead
- 2008 - 2 attacks, 2 dead
- 2009 - 6 attacks, 10 dead
- 2010 - 6 attacks, 20 dead
- 2011 - 21 attacks, 35 dead
- 2012 - 46 attacks, 60 dead
- 2013 (so far) - 1 attack, 1 dead
Source: International Security Assistance Force (Isaf). Some attacks in 2012 and 2013 are still under investigation and not included above.
Meanwhile, the Taliban claimed responsibility for almost every instance of an Afghan man in uniform gunning down his Nato ally. Few believe such claims are credible.
In August 2012, Nato officials estimated that about 25% of these attacks were the result of Taliban infiltration into the security forces. Officials had previously said that about 10% of the attacks had insurgent links. They have been quick to point out that Afghan forces also turn their weapons on other Afghan soldiers.
Nevertheless, Afghan officials believe this figure underestimates the true level of Taliban infiltration or influence.
The BBC's correspondent in Kabul, Bilal Sarwary, has examined a number of insider attack cases, and discovered that a disproportionate number of the soldiers come from two remote districts in Afghanistan's eastern Nangarhar province, close to the porous border with Pakistan. These are areas where Taliban militants wield influence over local populations and the writ of central government is weak.
Furthermore, our correspondent found that many of the cases involved fake recruitment files and Afghan intelligence officials have spoken of the "nightmare" of being confronted with yet another case of a rogue soldier whose recruitment files have serious flaws.
Vetting concerns: Abdul Saboor
In February 2012, police officer Abdul Saboor turned his guns on two Nato officials in the country's interior ministry. An investigation revealed he had already been sacked twice by the police but gained re-entry into the force.
In these remote districts, mobile phone ring tones sing out Taliban chants. Even if the Taliban have not actively recruited the rogue soldiers, the influence they might have on vulnerable soldiers is not to be taken lightly, intelligence officials argue.
One commander for the Afghan local police in Kunar - who used to be a Taliban fighter - told our correspondent: "Two years ago [in 2010] there was a decision taken by Taliban leadership to focus more on infiltration and rogue soldiers instead of suicide attacks, and other attacks."
But - perhaps worryingly for Nato - the motivation for many of the assaults cannot be pinned down so precisely. Many analysts believe they are rooted in underlying, even subconscious resentments that are prone to flare up and with deadly consequences.
CULTURAL DIFFERENCES - DAWOOD AZAMI, BBC WORLD SERVICE
In the early part of the last century, the British on India's north-west frontier worked with Pashtun militias and it was not uncommon for units with a good combat record to turn and shoot their British advisers. Many of these incidents were simply down to cultural misunderstandings.
Pashtun culture is governed by strict codes. The main pillar of the Pashtun code is called Pashtunwali and Afghans will do anything to protect this. It means they are very sensitive to anything perceived to insult their traditions, religion and values.
It has been called "motivation by rage rather than ideology" and perceived personal, cultural and religious transgressions can prompt such rage.
Sometimes such transgressions are seemingly innocent, but many security personnel come from conservative and rural areas where such codes are important.
Profanity is seen as deeply insulting, even though it may be used casually and even humorously by Western soldiers. When American soldiers raises their hand, it is generally a signal to stop. In Afghanistan, it is simply a greeting.
US soldiers are often accused of appearing arrogant and superior - such perceived attitudes can be deeply hurtful. Quite often foreign forces have no idea they have just insulted their colleagues.
And then there are the more serious transgressions.
In Afghanistan the desecration - albeit accidental - of the Koran, or American soldiers urinating on the bodies of dead Taliban fighters or posing for photographs with body parts have all caused anger.
One rogue soldier I interviewed after he killed three British soldiers in 2010 said he witnessed the killing of a young girl by coalition forces: "Was she a Taliban? They didn't even know her name," he told me. The UK Ministry of Defence rejects his claim.
Night raids and raids on homes of suspected fighters are to Nato ordinary and necessary military operations, but many Afghans believe the home is a sanctuary.
The list keeps growing and each incident reminds the soldier of all the previous indignities.
Under the Pashtun code called Melmastya, which means hospitality, Afghans will protect a guest at any cost. But their guests' conduct must also remain within certain parameters. If they fail to respect the values of their host, they cross the line.
Many of the soldiers killed by their Afghan colleagues - sometimes without even knowing - will have crossed the line.
COMBAT STRESS AND STRAIN - BILAL SARWARY, BBC NEWS, KABUL
The average Afghan soldier comes from poor and remote areas. One soldier told me that he joined up because he got rice and meat twice a day. These are the kind of luxuries they cannot afford in their communities.
Anatomy of a rogue soldier
In November 2010, an Afghan border policeman with an excellent record of service killed six US soldiers as they all sat down for tea during a routine training session. Why did he do it? A study of his life story - and his mobile phone - provided only a few clues.
On one recent trip, a number of border policemen told me they had been brought up by stepmothers and joined the police because they were not well looked after.
Another soldier said his only love in life was having a gun and firing it - that is why he joined the army.
But once they join up, the stresses and strains of a violent posting can place unbearable pressure on them. The food is terrible, they are exhausted and many complain that they do not get enough leave, their pay arrives late and when they fall ill, there is poor medical care.
Local commanding officers have little experience too and some soldiers complain of violence and sometimes even abuse.
When a young Afghan man in uniform posted to an area with a particularly brutal insurgency is faced with such pressures, the results can be unpredictable.
DIVIDED LOYALTIES - BILAL SARWARY
Family, village and tribal ties are the glue of Afghan society.
One of the angry protests against the inadvertent burning of copies of the Koran by Nato soldiers took place at a Nato base in Khogyani, in the eastern province of Nangarhar in February.
Local villagers came to the base and the protest turned ugly. One of the Afghan soldiers at that base was from the village and when he saw locals from his home village up against troops at the base he picked up his gun and killed two US soldiers.
The Afghan army does not allow soldiers to serve in their home village but, in this case, the village came to the base and the soldier could not contain his anger.
And a number of policemen and soldiers will have family members affiliated to the Taliban - such is the intricate web of Afghan family and clan networks.
Authorities say the vast majority of Afghan soldiers are professional and understand their duties. But circumstances can conspire to test loyalties.
At a recent ceremony at Bagram, one Afghan commander told TV crews where to start filming - he pointed out politically sensitive locations. A US soldier harshly reprimanded him for this.
The commander turned towards the US soldier via his translator and said: "If I had a gun, I would empty an entire magazine in your stomach."
THE VIEW FROM A US SOLDIER - MAJOR BENJAMIN TUPPER
I compare it to a marriage. Marriages start great, the first years are a honeymoon, the middle years get a little grinding. Sometime in the later years things fall apart.
My guess is a lot of people in Afghanistan, 10 years ago, loved the fact the West was there. A decade later they are just tired of it. They are tired of our fumbles and bumbles and mistakes. They are tired of the enemy that seems to have no shortage of bold attacks.
I also know the Americans and British and Romanians and Polish I served with in Afghanistan, we had good intentions. We went in there with the highest degree of respect and camaraderie that we could towards our Afghan soldier and police peers as well as civilians.
Even with those good intentions, we have to be honest that we have left a track record of mistakes. Some of them have been literal mistakes such as bombing the wrong compound.
I always point to the example of the sergeant who went out in the middle of the night and killed Afghan women and children. While we discount them and say that sergeant had mental problems, Afghans see a guy in US army uniform.
Even though 99.9% of us go in with good intentions and professional standards... some Afghans have gone from loving the West to wondering what our true intentions are.
Major Benjamin Tupper was interviewed for BBC Radio 4's PM programme. He is the author of Greetings From Afghanistan, Send More Ammo: Dispatches from Taliban Country.