The skeleton was found by council workmen at Victoria Primary School in the Newhaven area of Edinburgh, and later carbon dated by experts to the 16th or 17th century.
The school is near Newhaven Harbour, the closest port to Scotland's capital, which was once the site of a gibbet in which the bodies of executed criminals were displayed as a warning to others.
At first, archaeologists thought the man's skeleton was from the Bronze Age, due to the poor condition it was found in.
However, further investigation and carbon dating revealed the man had died much more recently. Due to the condition of the skeleton and its proximity to the harbour and gibbet rather than any of the three nearby graveyards, it is believed he was executed, either for piracy or another crime, and displayed in the gibbet before being buried in a shallow, unmarked grave.
The firm which uncovered the skeleton, AOC Archaeology, worked with forensic artist Hayley Fisher to create a reconstruction of the face of the man, who is believed to have been in his fifties when he died.
Recent archaeological discoveries
Recent archaeological discoveries
1/11 Recent archaeologist's discoveries
Divers Alberto Nava and Susan Bird discover the world's oldest skull found in an underwater cave in Mexico, believed to be the earliest trace of first Americans
2/11 Recent archaeologist's discoveries
Paleontologist Gary Morgan stands over the fossil of a stegomastodon skull discovered in a remote area of Elephant Butte State Park, N.M. in June 2012
AP Photo/Albuquerque Journal, Roberto Rosales
3/11 Recent archaeologist's discoveries
Scientists discovered the world’s oldest face, which belongs to this 419 million-year-old fish - an ancient sea predator that might also re-write the history of our evolution from the seas
4/11 Recent archaeologist's discoveries
An archaeologist discovered a tomb of an intact mummy of the Wari prehispanic culture in Lima's Huaca Pucllana ceremonial complex, at Miraflores district
5/11 Recent archaeologist's discoveries
One of the 46 fossils found at the site in southern Chile
6/11 Recent archaeologist's discoveries
Archaeologist James Best holding a Roman skull found during the building of a utility tunnel at Crossrail's Liverpool Street station site, London
7/11 Recent archaeologist's discoveries
In 2012 archaeologists unearthed two skeletons from the Middle Ages pierced through the chest with iron rods to keep them from turning into vampires. They were discovered in the Black Sea town of Sozopol, Bulgaria
8/11 Recent archaeologist's discoveries
Several horse shoes dating from the 2nd century AD have been found stuck in cart ruts in this area. Archaeologists believe the metal shoes, which were strapped rather than nailed to horses, came off as the animals were led up to a timber bridge over the Walbrook River
9/11 Recent archaeologist's discoveries
An archaeologist digs out a skull from the site of the graveyard of the Bethlehem, or Bedlam, hospital
10/11 Recent archaeologist's discoveries
Archaeologists discovered a dinosaur tail in Mexico's desert with the 50 vertebrae of the tail completely intact
11/11 Recent archaeologist's discoveries
Archaeologist found a terracotta warrior at the excavation site inside the No. 1 pit of the Museum of Qin Terracotta Warriors and Horses, on the outskirts of Xi'an, Shaanxi province, in June 2010
© Jason Lee / Reuters
Laura Thompson, the headteacher of the primary school, said: "The pupils think it's fantastic that a skeleton was found deep underneath their playground."
"The archaeologists will hold a special lesson with some of the children about how they have used science to analyse the remains and it will be a good learning opportunity for them."