A 20-year-old tried to climb the rocks on the landmark at 3.35am today, but got stuck around 40m above the ground and couldn’t get down.
Firefighters launched a one-and-a-half hour operation to save the man using rope rescue teams and a huge ladder, prompting onlookers to compare the man’s stunt to an escapade from video game Grand Theft Auto.
The man - who managed to call for help on his mobile while stuck on the rocks - was uninjured after the incident, the fire service said.
A fire service spokesman said: “At 3.35am control received a call from a male aged 20 who had climbed up the rocks and couldn’t get down
“Line rescue teams were deployed from Tollcross and Newcraighall.
“Firefighters made contact with the casualty via his mobile.”
The rope rescue teams went to the castle’s esplanade, while other firefighters waited on Johnstone Terrace below the south face of the landmark with a large mobile ladder.
Rescuers climbed down from above and helped the man onto the ladder, and he was lowered to the ground.
The operation was finished at 5am, the fire service said.
Part of the rescue was captured on social media, with one Twitter user comparing it to action from Grand Theft Auto.
Twitter user @funtobeused posted a picture of the ladder standing against the rock face, saying: “#edinburghcastle #GTA5achievement”