The gradual adoption of Islam by Indonesians was perceived as a threat by some ruling powers. As port towns adopted Islam, it undermined the waning power of the east Javanese Hindu/Buddhist Majapahit kingdom in the 16th century. Javanese rulers eventually fled to Bali, where over 2.5 million Indonesians practiced their version of Hinduism. Unlike coastal Sumatra, where Islam was adopted by elites and masses alike, partly as a way to counter the economic and political power of the Hindu-Buddhist kingdoms, in the interior of Java the elites only gradually accepted Islam, and then only as a formal legal and religious context for Javanese spiritual culture. The eastern islands remained animist largely until adopting Islam and Christianity in the 17th and 18th centuries, whereas Bali still retains a Hindu majority. By the late 15th century, the Majapahit Empire in Java had begun its decline. This last Hindu kingdom in Java fell under the rising power of the Islamized Sultanate of Demak in the 1520s; in 1527, the Muslim ruler renamed newly conquered Sunda Kelapa as Jayakarta meaning "precious victory" which was eventually contracted to Jakarta. Islam in Java then began to spread formally, building on the spiritual influences of the revered Sufi saints Wali Songo (or Nine Saints).