For almost 50 years, the keepers of Westminster Abbey have blocked all attempts to film inside to preserve the building and its mystique. But in a surprise move, the makers of a new Scottish film were given last-minute permission to shoot scenes within its hallowed walls.

The dean gave permission for scenes from Stone Of Destiny to be filmed inside the abbey, despite the movie retelling the story of one of the more embarrassing moments in its history, when four students stole the ancient stone from beneath St Edward's throne and under the noses of the English police.

The Anglo-Canadian co-producers of the multi-million-pound movie were delighted to be the first film-makers allowed inside the abbey since the remake of The Thirty-Nine Steps in 1959. Two years ago the makers of the Da Vinci Code were denied permission due to the tale being considered "theologically unsound".

Producer Andrew Boswell, head of film at The Mob Film Co, admitted he was not optimistic about being allowed to film inside the ancient church and had taken the precaution of shooting scenes in Paisley Abbey and Glasgow Cathedral, replicating Poets' Corner, Edward the Confessor's Chapel and the nave at Westminster.

He said: "First and foremost we were surprised to receive permission. We all hoped and prayed they would say yes, but being pragmatic we thought there was a very good chance they would say no, as they had already turned down the Da Vinci Code.

"They made us jump through hoops and we had to give them very thorough proposals, but after they said yes, our reaction was of delight."

The last scene was filmed in the early hours of yesterday morning. On site was Ian Hamilton, the gang's ringleader, who was in Westminster for the first time since lifting the stone 57 years previously. He looked on as actors Charlie Cox, Stephen McCole and Ciaran Kelly recreated the night when the stone was taken from the abbey and spirited to Scotland, sparking calls for Scottish independence.

Boswell said Hamilton was very excited about being back in the abbey and had an encyclopaedic knowledge of its layout. "We had a wonderful moment last night when we walked up the lane which leads to Poets' Corner and he accurately recounted how the abbey appeared that Christmas night in 1950.

"He has not been inside for 57 years and it was all quite emotional. It was incredible to see how much he knew. You could tell he had done his research because he knows the building like the back of his hand."

Boswell added that the makers of the film - written and directed by Charles Martin Smith, with a cast that includes Scottish stars Robert Carlyle and Billy Boyd - were overawed by the experience of working in Westminster.

"I don't think any us will work on a movie shoot again with a location which is so prestigious and with so much history in its walls and floors. It is a dream as a film-maker to be given this opportunity."

He added that it was important to shoot the film, based on Hamilton's book, where the actual events took place wherever possible: "When you have a true story you want to authenticate it as much as possible, and we've been able to do that in Glasgow and London."

The Stone of Destiny was originally kept at Scone Abbey, near Perth. It was the stone upon which all monarchs of Scotland were crowned, dating back to 847. In 1296 Edward I took the stone to Westminster Abbey where it was built into St Edward's Chair and used for the coronation of all English monarchs.

During the removal of the stone from Westminster on Christmas Day 1950, it was broken, along with one of the student's toes, and the two pieces were taken separately to Scotland where they were repaired and passed into the hands of the Church of Scotland. When the police were informed the stone was returned to Westminster Abbey.

Hamilton and his accomplices avoided prosecution.

In 1996 the stone was returned to Scotland, and now sits in Edinburgh Castle.