A soldier has been formally charged after “losing his rag” during a virtual battlefield exercise and killing his comrades.

The Edinburgh-based Army rifleman is believed to be the first soldier to be punished under UK military law for offences in a virtual scenario rather than in real life.

He is said to have been fed-up with being stuck at a computer rather than training outside.

A source from 3rd Battalion, the Rifles told the Mail on Sunday: “We'd spent two weeks sitting in front of laptops pretending we were in a really hostile urban environment - I'd challenge anyone to take it seriously for that long.

“All this was taking place in an office at our headquarters, when we'd rather be doing real-life soldiering outside in the fresh air. But there's less of that sort of exercise these days because the Army has committed to Unit-based Virtual Training.

“We were supposed to imagine we were travelling in armoured vehicles through a really hostile built-up area. One of the lads just lost his rag and ‘opened fire’ as it were, killing the soldier next to him.

“He then drove down the street deliberately smashing into cars. It's safe to say the officers in our battalion did not find it as funny as we did.”

The unidentified Rifleman was reprimanded after the exercise and later formally charged with disobeying orders.

His reputed punishment was to spend a weekend carrying out guard duties at the 3 Rifles base at Redford Barracks in the Scottish capital.

A Ministry of Defence spokesperson said: “We take the training of our service personnel very seriously and anyone who is disruptive to this training will receive disciplinary action.

“Virtual reality training programmes are able to deliver greater flexible training and replicate complex scenarios allowing for rapid experimentation, development of tactics and ability to test new vehicles in multiple environments.”

Sign up for your essential, twice-daily briefing from The Telegraph with our free Front Page newsletter.