Behind the Iron Curtain, Shakespeare's plays were a way to send secret messages about Soviet society to theatre audiences. Now a Lithuanian staging of Hamlet - designed to make Stalin, who hated the play, turn in his grave - will be performed in the UK. Why do these 400-year-old plays resonate in the former Eastern Bloc?

When Lithuania's biggest rock star, Andrius Mamontovas, was offered the role of Hamlet in 1996, he was rather surprised, but agreed to have a go. He has now played the prince for 15 years, and will soon perform the role in London as part of the UK's cultural festival to mark the Olympics.

There were nine months of rehearsals for a play that was at the beginning seven-and-a-half hours long, and even today lasts nearly four hours (there is also a cut-down version of just over two).

What has kept him going is Eimuntas Nekrosius, one of Europe's most renowned theatre directors, and the special prestige Shakespeare holds in the countries of the former Soviet Union.

Media playback is unsupported on your device Media caption Andrius Mamontovas on playing Hamlet

In Soviet-era Lithuania, there were productions of Shakespeare for which people queued through the night for tickets. Shakespeare was culture with official approval, but as one of the few alternatives to tales about earnest Soviet heroes, it was also a way for theatre directors to symbolically address forbidden issues. Going to the theatre had an excitement it perhaps lacks nowadays, says Mamontovas.

"I miss those secret messages... there were always little secret messages from the artist to the audience. But there's no need for that now because you can say what you want openly - it's more entertainment now."

Another appeal of staging Shakespeare was its soundtrack. Rock music was sometimes smuggled into productions in an era when many Western acts were banned - and the list of such acts was long and varied.

A telling exchange in Soviet times Hamlet: What have you, my good friends, deserved at the hands of fortune, that she sends you to prison hither? Guildenstern: Prison, my lord! Hamlet: Denmark's a prison. Rosencrantz: Then is the world one. Hamlet: A goodly one; in which there are many confines, wards and dungeons, Denmark being one of the worst.

"ACDC, Tina Turner - she was banned for her sexuality - the Stranglers, the Clash, they were one of my favourites. And there was Julio Iglesias," says Mamontovas.

The artistic director of Lithuania's National Theare, Audronis Liuga, recalls a landmark musical staging of Romeo and Juliet in 1982.

"It was a spirit of freedom, it was very youthful, very joyful, based on a lot of improvisation, very recognisable for this generation of people who were listening to the Beatles, Jesus Christ Superstar - this kind of music but not of course legally."

This new Lithuanian production is full of music, but no rock - although it's far from conventional, with not a doublet or hose in sight, and a coconut taking the place of Yorick's skull.

Image caption It is one of 37 companies performing at the World Shakespeare Festival at London's Globe Theatre

Then there is the history of Hamlet in the Soviet Union. An early landmark of Lithuania's professional theatre was a production of Hamlet by Mikhail Chekhov, nephew of the playwright Anton.

But Hamlet then fell out of favour. Stalin, it was understood, had turned against the indecisive Prince of Denmark. The uncomfortable comparisons between the setting of Hamlet, the dark world of Elsinore and the Kremlin, was perhaps too close.

Hamlet's uncle, Claudius, had usurped the throne, depriving the young Hamlet himself, and there were parallels - for those who wished to see them - in Stalin's seizure of Lenin's leading role and his demolition of rivals such as Trotsky.

There was also another layer of symbolism. Stalin, a keen theatregoer, took against the renowned director Vsevolod Meyerhold and had him arrested and tortured, and executed.

To be or not to be Best known of all of Hamlet's 1,500 lines

It's in Act III Scene I, and Prince Hamlet appears to be talking to himself

He's trying to establish his uncle's guilt in murdering his father and usurping the Danish throne

The speech is a deep philosophical reflection on life and death The six most familiar words in theatre

Meyerhold dreamed all his life of staging Hamlet, his favourite play, but somehow never managed it. He was renowned for having said, with bitter irony, that he wanted his tombstone to read: "Here lies a man who never played or directed Hamlet". From the day he was killed in 1940, Hamlet and the death of Meyerhold became intertwined in the public imagination.

Stalin's death in 1953 prompted a series of new Hamlet productions that tested the boundaries of how far the post-Stalin thaw had gone, and so the play gained a symbolic status of freedom of expression.

The director of the Globe Shakespeare Festival, Tom Bird, says this resonance is echoed across the region.

"There's a feeling in the former Soviet Union that Shakespeare was never censored. So he becomes in a lot of these places not just a writer but almost a freedom fighter, almost a saint.

"If you go in to the countryside in Armenia you meet people with the name Shakespeare - their first names are Shakespeare.

"The most famous footballer in Armenia is Henrikh Mkhitaryan and his middle name is Hamlet. And no, Hamlet isn't Armenian for Hamish; it's Hamlet, the Dane. It's incredible it's seeped in to everything."

But there is also a sense that something has passed. They do not miss the fear, but the privileged position of high culture and Shakespeare has slipped. Tina Turner and Julio Iglesias may have been banned, but there was a deep reverence for Shakespeare.

Fifteen years on, Mamontovas is still eager to carry on playing the Danish prince for a few more years. But he knows the clock is ticking.

"I am very happy and very lucky to be here, this play has opened a lot of doors for me. I took this on when I was Hamlet's age, around 29, it would be strange if I was still being Hamlet when I'm 50."

Hamlet will be performed at London's Globe Theatre 2-3 June as part of the Globe to Globe festival .