Human remains found under an Edinburgh primary school playground may have belonged to a 16th century pirate, experts have said.

The remains were first found beneath Victoria Primary in February 2014 as work to build an extension was carried out.

Archaeologists determined the bones were those of a man in his fifties. The location of his remains near a historic gibbet in the dockyard has led to the suggestion he could have been hanged as a pirate, with his body displayed to deter sailors from piracy.

Painstaking work was undertaken on the bones and a facial reconstruction was made of the man's skull by forensic artist Hayley Fisher.

Due to the nearby discovery of Bronze Age pottery, the man was at first thought to date back 4,000 years, but the bones were later carbon dated to the 16th or 17th centuries.

Victoria Primary School is situated close to the harbour in Newhaven, one of Scotlands historic fishing villages.

Councillor Richard Lewis, culture convener for the Edinburgh council, said: "Edinburgh has an undeniably intriguing past and some of our archaeological discoveries have been in the strangest of places.

"Thanks to carbon dating techniques, archaeologists now know that the skeleton was likely to have been a murder victim and quite possibly a pirate.

"It's fantastic that through the council's archaeology and museums service, we are able to investigate such discoveries and add to our understanding of Newhaven's heritage."

A gibbet stood on the edge of Newhaven dockyards 600 years ago and it is believed the man could have been murdered in the device for criminal behaviour or piracy and discarded in nearby wasteland.

The man's unceremonial burial suggests he had no relatives in the area and his body may have been used to deter other pirates.

Laura Thompson, head teacher at Victoria Primary School, said: "As the oldest working primary school in Edinburgh, we are proud of our history and heritage and the school even has a dedicated museum to the local area.

"The pupils think its 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."