THE story of how a Southampton pub defied the giants of Hollywood is the inspiration for a new play to premiered in the city.

Nuffield Southampton Theatres (NST) has commissioned the new work which centres on the legal wrangle between the makers of the Lord of the Rings trilogy and the Hobbit pub in Bevois Valley.

And the project has the backing of Gandalf himself - actor Sir Ian McKellen who was in Southampton this week to to perform his one-man show at the Nuffield.

The Hobbit became involved in a David and Goliath struggle with film producers Saul Zaentz Company who claimed the pub had infringed its copyright even though it had been trading under its name for 20 years, before the films were made.

The movie mogul, who owns the worldwide film, stage and merchandising rights to The Lord of the Rings trilogy and The Hobbit, argued the pub should change its name and remove all reference to the Tolkien tales.

A campaign to save The Hobbit pub name was launched on the Internet – attracting more than 3,000 followers.

Samuel Hodges, director of NST, who will be directing the new play, said: "With Tolkien’s masterpiece interrogating the battle between disadvantaged man and the things the world throws at him, this is life imitating art in both senses of the phrase, and a brilliant premise for a new play."

Sir Ian, who played wizard Gandalf in the Lord of the Rings and The Hobbit trilogies, marked the announcement of the play with a surprise visit to The Hobbit Pub earlier this week.

The actor posed for pictures with staff during his visit on Wednesday.

Stella Roberts, the manager of The Hobbit, said: "Members of staff said he was amazing, so nice and just lovely. He said he liked the pub very much and I am gutted I missed him."

She added: "It is not everyday Gandalf walks into The Hobbit."

Barman Andrew Bailey said: "At four o'clock I suddenly saw Ian's face at the door and I said 'I have to open the pub now'. Around 20 people afterwards ran down to The Hobbit asking if he was still here."

Sir Ian and Stephen Fry helped support the pub in its battle with Hollywood during which the theatrical knight described the film company's actions as "unnecessary pettiness".

A date or writer for the new play has yet to be comfirmed.