A painting of Puck, Shakespeare’s mischievous elf from A Midsummer Night’s Dream, sitting on a toadstool as nude fairies dance under his feet will keep its 170-year connection with Preston after the Harris Museum and Art Gallery saved it from auction.

The 1840 canvas was created by Richard Dadd, the most famous of the Victorian “fairy painters”, two years before a descent into mental illness which saw the Chatham artist murder his father in 1843, leading to spells in Bedlam and Broadmoor. The dark undertones of the piece are thought to reflect Dadd’s turbulent mindset.

Thomas Birchall, a wealthy Preston solicitor who went on to become Mayor but was found to have had multiple mistresses, a number of illegitimate children and suspect financial dealings following his death, originally bought the piece in the 1840s.

Owners the Finnis Scott Foundation had lent it to the Harris since June 2009, but fears that it could be sold have been vanquished thanks to a successful fundraising alliance, led by the Heritage Lottery Fund and the Art Fund.

“Puck has already proved to be hugely popular with our visitors,” said Alexandra Walker, the Head of Arts and Heritage at Preston City Council. “We are very grateful to our funders for helping us to keep it in Preston.”

A companion piece to Puck, Titania Sleeping, is in the Louvre in Paris, and a later painting by Dadd, The Fairy Feller’s Masterstroke, is held by the Tate.

Stephen Deuchar, the Director of the Art Fund, called the painting “striking” and “beautifully detailed.” “This is a wonderful example of the Victorian fascination for otherworldly scenes, and its dark and fascinating back story makes it even more interesting,” he observed.

“The Preston connection makes the painting a particularly apt addition to the Harris Museum’s public collections.”

Lottery funding will allow planners at the Harris to devise a range of activities enticing local visitors to enjoy the work. The park where Birchall’s home of Ribbleton Hall once stood will also become the setting for a garden inspired by the themes of A Midsummer Night’s Dream.