Pre-Islamic Bugis cosmology, as preserved in the Sureq Galigo cycle, describes three connected realms: Boting Langi, the upper world of the sky, Peretiwi, the underworld beneath the sea, and Ale Lino, the middle world where humans live. The cycle's opening movements tell how the high god Patoto'e sent his son down from Boting Langi and a daughter of the sea-realm rulers up from Peretiwi to marry and found the first Bugis kingdom, Luwuq, making the ruling lines of Bugis society descendants of both sky and sea. Composed in a formal poetic meter over centuries and first written down between the eighteenth and twentieth centuries, the cycle is often described as the longest single literary work in the world, running to hundreds of thousands of lines across dozens of manuscripts, no complete version of which survives in any one place.
Islam arrived in South Sulawesi's Bugis kingdoms in the early seventeenth century and became, within a few generations, the religion of the great majority of Bugis people. The older cosmology did not simply disappear: it persists inside Islamic practice as pangngadereng, the customary law and etiquette that still shapes Bugis social life, in the person of the bissu, ritual specialists once attached to the courts of Luwuq and its neighbors, and, most completely, in the To Lotang community of Sidenreng Rappang, who maintain the pre-Islamic religion as a distinct practice today, registered for legal purposes under Indonesia's recognition of Hinduism since 1966.