TREE specialists worked their magic on a historic cedar that featured in a Harry Potter film as it was in danger of collapsing.

The famous cedar of Lebanon tree in the grounds of Blenheim Palace needed emergency treatment to stop it from falling over.

The 300-year-old tree, with its distinctive hole in the middle of its trunk, became an international star after it appeared in one of the scenes in ‘Harry Potter and the Order of the Phoenix.’

In the 2007 film Alan Rickman’s character Severus Snape, the Potions master, endures a flashback where he is being bullied by Harry’s father James and Sirius Black, who cast a spell that dangles him upside down from the top of the tree.

Head of Estates Roy Cox said: “Since the film’s release it has become a must-see destination for Harry Potter fans and people have travelled from around the world to view it.

“This tree is one of our most iconic features within the World Heritage Parkland.

“Living near to the lake and sitting just beside our famous Grand Bridge it would have been planted around the time of the famous landscape architect ‘Capability’ Brown and can be seen from the Palace.”

But it was the tree’s distinctive feature that made it so weak that it could have toppled over at any minute.

As part of the rescue plan, a team of tree surgeons used climbing ropes and a cherry picker to attach specialist cables, using the latest technology, to support its larger branches and reduce the chances of it collapsing.

Mr Cox added: “Our forestry team are working with specialist heritage tree experts to stabilise the tree, to give it the best chance for the future and importantly keep it open to our visitors.

“Cedars at this age are a risk and if we do not take decisive action the tree would have had to have been permanently fenced off from our visitors and be lost for future generations of Harry Potter fans.”

As its name suggests the tree originates in Lebanon, Palestine, Israel, northwest Jordan and western Syria.

It can reach up to 40 metres in height, with a trunk up to 2.5 metres in diameter.

It is unknown when the first cedar of Lebanon was planted in Britain, but it dates at least to 1664, when it is mentioned in Sylva, or A Discourse of Forest-Trees and the Propagation of Timber.

In 2014 an ancient yew in Hertfordshire, which had starred as the ‘Whomping Willow’ in the grounds of Hogwarts, split in two and collapsed.

As far as the estate knows the cedar is the last standing Harry Potter tree.