Daniel James (left) was a translator for Gen Sir David Richards
Army interpreter Daniel James, found guilty of spying for Iran last month, has been jailed for 10 years.
It had already been decided that he would not be re-tried on two charges which a jury failed to agree on.
The Iranian-born corporal had been the personal translator for the head of multi-national forces in Afghanistan, Gen Sir David Richards.
James, 45, from Brighton, was convicted of a single count of communicating information useful to an enemy.
The court heard he sent coded messages to an Iranian military attache in Kabul, saying: "I am at your service".
But an Old Bailey jury was unable to reach a verdict on charges under the Official Secrets Act relating to his possession of a USB memory stick containing sensitive documents, and a second of misconduct in public office.
Prosecutors had said they would consult the Attorney General, Baroness Scotland, on whether to seek a retrial.
But on Friday Mark Dennis QC applied for the charges to be allowed to lie on file, meaning there would be no further proceedings, although James has not been formally cleared of the allegations.
The judge, Mr Justice Roderick Evans, said James was a "ripe target" for the Iranian authorities.
He said: "You were all the more ripe because you were susceptible to such an approach due to a number of factors.
"Firstly your background as a person with dual nationality. Secondly this relationship coincided with a period in which you were disenchanted with the army.
"Thirdly your personality played a substantial part in your vulnerability and your succumbing to the approach that was made to you.
"You have a grossly inflated view of your own importance and ability.
"Your counsel has said you should never have been put in the position you were put in and you were obviously unsuited to that position. I have no doubt there is force in that submission."
Senior intelligence officers believed that if he had not been arrested his actions could ultimately have cost the lives of UK soldiers and even endangered the security of Britain itself.
After joining the Territorial Army he was sent to Afghanistan in May 2006, where he worked for Gen Richards, who has since been named as the next head of the British Army.
James was arrested in December 2006, just two months after he had made contact with Colonel Mohammad Hossein Heydari, an Iranian military assistant based at Tehran's embassy in Kabul.
But jurors were told he was arrested before he could become a fully-fledged agent.
He was described in court as a flamboyant fantasist who had invited his boss to salsa dance.