According to Mahaparinibbana Sutta, after his death, the Gautam Buddha was cremated and the ashes divided among his followers. Originally his ashes were to go only to the Shakya clan, to which Buddha belonged; however, six clans and a king, demanded the body relics. To avoid fighting, a Brahmin Drona divided the relics into ten portions, eight from the body relics, one from the ashes of Buddha's cremation pyre and one from the pot used to divide the relics, which he kept for himself. After The Buddha's Parinibbāna, his relics were enshrined and worshipped in stupas by the royals of eight countries: to Ajatasattu, king of Magadha; to the Licchavis of Vaishali; to the Sakyas of Kapilavastu; to the Bulis of Allakappa; to the Koliyas of Ramagrama; to the brahmin of Vethadipa; to the Mallas of Pava; and to the Mallas of Kushinagar
A stupa is a monument specifically to house such relics. Often they were enclosed in caskets (such as the Kanishka casket or the Bimaran casket).
The relics were later dug up by Ashoka, and used the relics (said to have been divided into 84,000 portions) and had stupas built over them throughout the region he rules. Many of the remains were taken to other countries. The Ashokavadana narrates how Ashoka redistributed Buddha's relics across 84,000 stupas, with the distribution of the relics and construction of the stupas performed by Yakshas.
When the Chinese pilgrims Fa-hien and Hiuen Tsang visited India centuries later, they reported most of ancient sites were in ruin.
The Lokapannatti (11th/12th century) tells the story of King Ajatashatru of Magadha who gathered the Buddha's relics and hid them in an underground stupa. The Buddha's relics were protected by spirit-powered mechanical robots (bhuta vahana yanta) from the kingdom of Roma visaya until they were disarmed by King Ashoka.