Spain ruled the Philippines for over 300 years, imposing its language, culture and religion. Consequently the population became predominantly Roman Catholic. Nationalism developed among the Filipinos during the latter part of the nineteenth century. There were two serious revolts in 1872 and 1896, which were crushed by the Spanish colonial government. In 1898, however, Spain was defeated by the United States in a war over Cuba, and as a result Philippines became an American colony.