The bodies are believed to be those of local farmers kidnapped by the Shining Path rebel group in the 1980s.
Forensic experts said it was clear the 17 had been killed but not by whom.
Almost 70,000 people were killed in the two-decades-long conflict between the Peruvian government and the Maoist rebels, according to figures by Peru’s Truth and Reconciliation Commission.
Prosecutor Honorio Casallo Diaz said investigations carried out by the Truth and Reconciliation Commission suggested the farmers had been abducted in the 1980s from the town of Vilcashuaman by members of the Maoist Shining Path guerrilla group.
They had been missing ever since.
This was a common practice by the Shining Path to boost their ranks.
However, it is not clear whether the 17 were killed by their Shining Path captors or by members of the military, who often targeted locals they suspected of collaborating with the guerrillas.
Ayacucho was the heartland of the guerrillas and farmers were often caught between the two warring sides.
The Shining Path posed a major challenge to the Peruvian state in the 1980s and early 90s.
After the capture of its main leaders its influence was greatly reduced.
However, remnants of the group are still active in the jungle areas of Peru producing and smuggling cocaine.