Emma Thompson is to portray the Queen in a TV drama based on the famous Buckingham Palace burglary 30 years ago.

Intruder Michael Fagan sneaked into the palace and managed to find his way into her bedroom, sitting on her bed and chatting for ten minutes.

The incident has been adapted for a film called Walking The Dogs, to be screened by Sky Arts in the spring.

It also features Eddie Marsan – whose roles have included menacing parts in Happy-Go-Lucky and Tyrannosaur – as Fagan.

Russell Tovey plays a footman who had been walking the royal corgis instead of guarding the bedroom in the film, part of a new series of comedies and dramas called Playhouse Presents.

Fagan, who was 31 at the time, was initially charged with the theft of some wine from the palace but the charges were later dropped and he went on to be detained for several months in a psychiatric hospital.

His encounter with the Queen was actually his second visit to the royal household, after previously scaling a drainpipe and scouting round the corridors before leaving.

The Queen engaged Fagan – who was bleeding after he broke an ashtray – in conversation until help arrived.

The incident was immortalised in the title track of The Smiths album The Queen Is Dead two years later. The song includes singer Morrissey’s lines: “So I broke into the palace with a sponge and a rusty spanner; she said: ‘Eh, I know you, and you cannot sing’, I said: ‘That’s nothing – you should hear me play piano’.”