A former British army interpreter was convicted of espionage Wednesday for sending e-mails to an Iranian diplomat while serving in Afghanistan.

Iranian-born Cpl. Daniel James, whom prosecutors depicted as an eccentric character who fantasized about being a hero, was found guilty of communicating information to an enemy.

The jury continued to deliberate on two other charges related to a memory stick that contained secret NATO documents and a count of misconduct in public office. His sentencing won't take place until the verdicts on those charges are finalized.

The Defense Ministry said he will be discharged from the military.

In 2006, James was stationed in Afghanistan, where he acted as interpreter for former Gen. David Richards, then-NATO commander in the country.

James, 45, who was born in Iran but moved to Britain as a teenager, denied the charges. He also told the court he was a Voodoo priest and had used black magic to protect Richards from the Taliban.

Prosecutors said James, a former salsa dance instructor, was heavily in debt. They also said he was a fantasist and "something of a Walter Mitty character." The description refers to a character who fantasized about being a hero in a story by the late American author James Thurber.

Prosecutors said James began sending coded e-mails after meeting an Iranian military attache in late August 2006. One read "I am at your service," prosecutors said.

"The defendant's loyalty to this country wavered and his loyalties turned to Iran, the country of his birth," prosecutor Mark Dennis told jurors during the trial. "He turned his back on those with whom he was serving in Afghanistan and sought to become an agent for a foreign power."

During the trial, James denied that charge, saying, "nonsense. I am still loyal to Britain. I am still a soldier."

James said his e-mails were an attempt to set up a deal for Afghanistan to buy gas from Iran, and believed that any arrangement could benefit the U.S. by reducing energy prices. He said the e-mails weren't a code, but rather an attempt to sound "sexy and important."

James joined the British army reserves in 1987, and was called up to serve a tour in Afghanistan in March 2006. Two months later, he was appointed translator for Richards, who was then the overall commander of the International Security Assistance Force in Afghanistan.