Image copyright Reuters

A laboratory test carried out for BBC Panorama shows that Volkswagen diesel cars programmed with a "defeat device" can cheat official European pollution tests, as well as tests in the US.

The company told the BBC it believes this is the first time the cheating software has been filmed in action.

VW has admitted it used the device to rig tighter pollution tests in America.

But it's been more ambiguous about whether it used the same tactics to actively cheat official European tests.

Panorama's results suggest that it did.

It could have huge implications for the company, which says it is still yet to determine whether the cheating software even breaks the law in Europe.

Media playback is unsupported on your device Media caption Panorama shows in graphic detail how Volkswagen can cheat European tests

VW has confirmed that 8.5 million European cars have the software, 1.2 million of them in the UK.

The defeat device is a programme in the car's computer that can work out when it is being tested in a laboratory, and then cut poisonous nitrogen oxide (NOx) gas pollution from the exhaust pipe.

For years, this software allowed the company to pass strict US emissions laws yet still make a car that performed well on the road. Now it looks possible that VW was also cheating in Europe.

A side-effect of cutting NOx can often be lower miles-per-gallon.

Panorama took a VW Passat Blue Motion diesel to an accredited testing laboratory in the Czech Republic. No British lab we asked would let us in, but this lab is governed by the same rules and regulations as those in the UK and it regularly certifies new cars and engines for the European market.

We also took a retired former government vehicle inspector, Ted Foreman, along to make sure everything was done by the book (a 280-page book).

Clever software

And we confirmed the Passat was programmed with the defeat device.

After prepping the car to the letter of the regulations, the lab ran the standard Euro 5 emissions test. It's the same exam this model of car would have had to have passed before it went on sale.

And it passed. Emitting just 167 mg/km of poisonous NOx gases. The Euro 5 limit is 180 mg/km.

VW's clever software knows when it's being tested, because the routine is the same every single time. Starting with a cold engine, in a lab that's between 20 and 30 degrees centigrade, it's then driven for six miles on a rolling road, no turns, with exactly the same gear changes at exactly the same times, and all within a speed at two km/h either side of set limits.

The whole thing, including some idle time, always lasts 20 minutes and 20 seconds.

So, we then tried to trick the computer into thinking it was out of the lab, by simply accelerating hard a few times, taking it above motorway speeds. Straight afterwards, we ran the Euro 5 test again, but with one simple difference. We started with a hot engine this time.

The same car failed, spectacularly. Emitting 435 mg/km of NOx (remember the EU limit is 180 mg/km).

So, drive the same drive, but fool the car into thinking it's on a real road, and it chucks out two-and-a-half times the amount of pollution as before.

Image caption Richard and retired former government vehicle inspector, Ted Foreman examine the test results for a VW diesel engine

When we showed VW our results, they confirmed the car had been cheating.

"With this software, it was possible for the vehicle to recognise laboratory test conditions and the engine control could switch over to emitting compliant nitrogen dioxide levels during the test cycle.

"This would have been the likely condition in your test. As you ran the second test (described as a hot test) immediately afterwards, the vehicle did not recognise this as a test condition and changed its emission strategy."

The car industry has always said that pollution is worse out on the roads because of bad driving, bad weather and hills. Panorama's test suggests that cars are also to blame.

This scandal has a long way to run. We still don't know what might happen to all the "fixed" cars. Will they have a worse MPG for example? And we still don't know how many billions of euros it'll eventually cost the company.

Richard Westcott's report on Volkswagen will be shown on Panorama on BBC World News on Saturday 12 December and Sunday 13 December.