Media playback is unsupported on your device Media caption David Heaton was secretly filmed as part of a BBC Panorama and Private Eye investigation

A government tax adviser who was secretly filmed offering tips on how to keep money "out of the chancellor's grubby mitts" has resigned.

David Heaton, who went on to advise HM Revenue and Customs on tax avoidance, was filmed at a London conference in a probe by BBC Panorama and Private Eye.

He told the audience how they could exploit maternity pay rules "to get the government to pay your bonuses".

He has said he does not advocate artificial or abusive tax arrangements.

Two months after the conference - entitled 101 Ideas for Personal Tax Planning - Mr Heaton started work on the key HMRC panel.

His job was to advise HMRC and the courts about artificial and aggressive tax avoidance.

No 'abusive tax arrangements'

At the conference, Mr Heaton was caught on camera describing a maternity scheme he called the Bump Plan.

He said: "Ninety per cent of what you pay out ends up with the employee. You can't really knock that one."

By deliberately timing bonuses to enable an increased rebate on maternity pay, the tax paid on the bonus would effectively fall from 41.8% to just 8.4%, he explained.

HMRC told BBC Panorama that the Bump Plan would be an abuse and that they would challenge anybody using it.

Mr Heaton denied doing anything wrong, but his resignation was announced on Friday.

Treasury minister David Gauke said: "Mr Heaton's statements are directly at odds with the government's approach to tackling tax avoidance, therefore it is right that Mr Heaton resigns from his position."

At the conference, which members of the audience had paid £1,000 to attend, Mr Heaton was also filmed offering nine other tips to reduce an individual's tax bill.

Chairwoman of the Public Accounts Committee Margaret Hodge said she was shocked by Mr Heaton's comments.

"This is an absolutely classic example of where government passes a law with a particular intent and the tax advisers then abuse that and use it for a purpose that was never intended by government."

Mr Heaton had told Panorama he frequently used irreverent language to make his presentations more interesting, adding: "I do not believe a person who advocates artificial or abusive tax arrangements should be a panel member. I did not advocate any such arrangement at the conference and do not advocate such arrangements."

You can watch Panorama: Tax, Lies and Videotape on BBC One, Monday 16 September at 20:30 BST and then in the UK on the BBC iPlayer.