User identities belonging to two Zygna employees were stolen during the scam. Photograph: Gregor Schuster/zefa/Corbis

A British computer hacker who stole 400bn virtual gaming chips from an international gaming company has been jailed for two years.

Ashley Mitchell, 29, broke into the Zynga mainframe, stole the identity of two employees and transferred chips said to be worth more than £7m to himself.

Mitchell, of Paignton, Devon, sold the chips through Facebook to other gaming enthusiasts and used the money to fund his online gambling addiction.

More than 50 million people a day play Zynga games, including Mafia Wars, in which players run a virtual mob business, and FarmVille, which allows users to create their dream farm. Players have to buy chips for their virtual worlds. A black market in cut-price chips has grown up on the internet.

Mitchell, a former council accounts clerk, made £53,612 in two months after selling about a third of the chips.

But James Taghdissian, prosecuting, told Exeter crown court that Zynga put its loss at $12m (£7m). "That is what they estimate they would have lost if all the chips were successfully sold on," he said.

He said the company became aware in August 2009 that large amounts of chips were vanishing and suspected the two employees whose identities Mitchell had adopted. However, investigators then realised the system had been hacked and narrowed the search to Paignton. Mitchell's neighbours had their computers seized because he was "piggy-backing" on their unsecured Wi-Fi connections. Mitchell was eventually identified because he used his own Facebook profile during one of his attempts to hack into the system.

Taghdissian said: "It was clear there had been a systematic approach adopted in probing and accessing Zynga. Checks on [Mitchell's] bank account showed at this time he bought items including a Rolex watch and was also spending money on online gambling."

"He made determined and repeated efforts to attack Zynga's systems. He succeeded and transferred 400bn chips and sold them to realise a substantial profit."

Ben Darby, defending, said the loss to Zynga was impossible to quantify because the chips were virtual and the company could create as many as it wants.

He said Mitchell had enjoyed little benefit and spent most of the proceeds on online gambling on other sites that use real money.

He said: "Gambling had complete control of his life." He said his client was now an internet entrepreneur with his own Facebook poker site called Gambino, which could earn him more than £100,000 a year.

Mitchell admitted computer misuse and four counts of money laundering and asked for 41 similar cases to be considered. He was also sentenced to 30 weeks for breaching a 40-week suspended sentence imposed in 2008 for hacking into the computer system of Torbay council, where he once worked.

Judge Philip Wassall told him: "The dishonesty in this case was substantial and protracted. Online security is a priority for everyone these days.

"You deprived Zynga of income. It is quite clear you used a considerable degree of expertise and persistence to hack into the system.

"It is a considerable aggravating feature that someone hacks into systems in this way when so much business and personal finance is done using electronic means.

"From internet banking to major international transactions, people rely on the security of systems and anyone who comes before the courts who has gone through these security systems from their own ends can expect custody.

"The sentence has to reflect the impact on public confidence in security systems and online business when someone breaches security in this way."