The scene of the accident in Dundas Street. Picture: Greg Macvean

The victim is understood to have been walking along Dundas Street when he lost his footing and a spike went through his jaw.

Firefighters had to use specialist hydraulic cutting gear to free the man before he was taken to Edinburgh Royal Infirmary.

As the emergency services worked desperately to rescue him, a dentist from a nearby surgery dashed to the man’s aid by delivering oxygen.

Sign up to our daily newsletter The i newsletter cut through the noise Sign up Thanks for signing up! Sorry, there seem to be some issues. Please try again later. Submitting...

Police and firefighters at the scene as a piece of the railing had to be removed. Picture: Kaye Nicolson

Despite his injuries, witnesses said that they saw the victim speaking to paramedics and Medic One fast responders who were treating him on the street.

One onlooker, who asked not to be named, said she initially thought the man was drunk and being restrained by police officers before she realised he was injured and they were holding him up. She said that a trickle of blood could be seen running down the man’s neck.

Staff at a nearby business raised the alarm at around 4.20pm, after seeing the victim up against the railings, which are just under 5ft high.

Another passer-by said he could see a man up against the barriers, but it was not clear how he had ended up impaled.

The victim was taken to hospital as soon as he was freed, but the scene remained cordoned off for more than an hour after the incident. Firefighters from McDonald Road and a specialist unit from Newcraighall left the scene at 5.10pm, following a debriefing from the incident commander.

They could be seen hosing down equipment and ladders and removing bags of rubbish from around the cordon before standing down.

Two blood-stained cushions could be seen on the pavement, while a pool of blood was clearly visible underneath the barrier.

The three individual railings which were partially removed in the rescue operation were discarded on steps leading to a basement below.

Two police officers, one of whom was wearing latex gloves, stood guard at the cordon.

The dentist who had assisted the victim declined to comment. However, a member of staff at the Dundas Street surgery commended the emergency services for their swift response.

A spokeswoman for the Scottish Fire and Rescue service said that firefighters were mobilised following a request from police, who reported that the victim had been “impaled in the head”.

She said: “We assisted the ambulance service and Medic One in extricating the casualty from the railings. Hydraulic cutting gear was used and then the casualty was transferred.”