It is the nail-biting, crowdpleasing story of a plucky everyday hero encountering a mighty empire. Now, in a double dose of life imitating art, a new play is to tell how the Tolkien-themed Hobbit pub in Southampton clashed with a Hollywood film company over copyright infringement.

Samuel Hodges, director of Nuffield Southampton Theatres, has announced that he is commissioning a play about the dispute between the pub, which has held its name for more than 25 years, and the producer Paul Zaentz. In 2012, the establishment was threatened with legal action by Middle-earth Enterprises, a division of the LA-based Saul Zaentz Company, which owns worldwide merchandising rights to The Hobbit and The Lord of the Rings.

Ian McKellen, who plays Gandalf in the film franchise based on the books, spoke out at the time in support of the public house, which sells Gandalf and Gollum cocktails and “Bag End burgers”. Zaentz offered to “amicably resolve” the dispute over a pint, telling the BBC: “Regardless of the size of the company, if we didn’t go after these infringements, then other people would say, ‘If they can use them without authorisation, why can’t we?’”

This week, McKellen marked the announcement of the new play (which as yet has no playwright attached) while visiting Southampton with his one-man show celebrating his 80th birthday.

Hodges said: “With Tolkien’s masterpiece interrogating the battle between disadvantaged man and the things the world throws at him, this is life imitating art … and a brilliant premise for a new play. As we have over the last year with The Shadow Factory [about Southampton’s response to the German bombing in 1940] and SS Mendi [about a maritime disaster in 1917], we want to continue to celebrate and share local stories with our audiences.”