Durham Palace Green remains were Scottish prisoners
Skeletons found near Durham Cathedral were those of 17th Century Scottish prisoners of war, tests have revealed.
Between 17 and 29 sets of remains were found in a mass grave in 2013 during work on a university library.
The bodies appeared to have been tipped into ground, all jumbled together and without signs of ceremony.
Following detailed study, experts from the university have dated them to 1650, and believe them to be soldiers captured during the Battle of Dunbar.
Dr Andrew Millard, from Durham University's Department of Archaeology, said: "Taking into account the range of detailed scientific evidence we have now, alongside historical evidence from the time, the identification of the bodies as the Scottish soldiers from the Battle of Dunbar is the only plausible explanation."
The battle took place during the Civil War when English Parliamentarian forces defeated a newly recruited and unprepared Scottish army.
An estimated 5,000 Scottish soldiers were taken prisoner and marched miles from the south east of Scotland to Durham.
Many died en route, some were executed and some escaped but about 3,000 were imprisoned in the cathedral, which was at the time abandoned after worship had been suppressed by order of Oliver Cromwell.
During the hard winter of 1650-51, it is thought up to 1,700 of those incarcerated there died of malnutrition, disease and cold.
Senior archaeologist Richard Annis said: "This is an extremely significant find, particularly because it sheds new light on a 365-year old mystery of what happened to the bodies of the soldiers who died.
"Their burial was a military operation: the dead bodies were tipped into two pits, possibly over a period of days.
"They were at the far end of what would have been the Durham Castle grounds, as far as possible from the castle itself - they were out of sight, out of mind.
"It is quite possible that there are more mass graves under what are now university buildings that would have been open ground in the early to mid-17th Century."
The skeletons, found during work on Durham University's Palace Green library, were of young men aged between 13 and 25, whose skulls showed rampant tooth decay, or evidence of them having suffered poor nutrition or illness during childhood.
Some had smooth crescents of wear in the tooth crowns caused by holding the long stem of a clay pipe between the teeth.
To comply with legal requirements, the remains will eventually be reinterred in an approved burial site.