Prayers for the departed were said and a piper played a lament as the bones were laid to rest beneath a new headstone in a cemetery next to the former Ravenspark Hospital in Irvine, North Ayrshire.
Workmen for Dundas Estate, who have developed 75 homes on the site, found the skeletal remains of 35 people, in a mass grave dating back to the 19th century, last year.
Investigations by forensic scientists and archeologists, established the skulls and bones were part of a paupers' grave for those without families or whose relatives could not afford a proper burial.
The hospital operated as a poorhouse and asylum during the 19th century and the bones were in a mass grave not marked on any maps. The bodies of some who died at the hospital would also have been given over for medical research.
After the remains were found, relatives of people who may have been buried at the site came forward to find out if their identities could be established.
A decision was taken to give them a proper burial with a joint service by both the Church of Scotland and the Catholic Church.
Bruce Dunlop, managing Ddirector of Dundas, said the service was a "fitting conclusion" to a sad story.
He said: "Holding the memorial to properly re-inter the bodies was the right thing to do. A number of people who feel they may have family in the grave attended the ceremony."
North Ayrshire Council Depute Provost Councillor Robert Barr laid a wreath during the ceremony, led jointly by Rev Robert Travers of Irvine Old Parish Church and Father Willie Boyd of St Mary's Church in Irvine.
Father Boyd said: "These people should never have been left in an unmarked grave, and this memorial should remind us all of those who are marginanlised by society."