The history of the Philippines is known to have begun at least 709,000 years ago as suggested by the discovery of Pleistocene stone tools and butchered animal remains associated with hominin activity. Homo luzonensis, a species of archaic humans, was present on the island of Luzon at least 67,000 years ago. The earliest known modern human was from the Tabon Caves in Palawan dating about 47,000 years. Negrito groups were the first inhabitants to settle in the prehistoric Philippines. By around 3000 BC, seafaring Austronesians migrated southward from Taiwan.Scholars generally believe that these social groups eventually developed into various settlements or polities with varying degrees of economic specialization, social stratification, and political organization. Some of these settlements (mostly those located on major river deltas) achieved such a scale of social complexity that some scholars believe they should be considered early states. This includes the predecessors of modern-day population centers such as Maynila, Tondo, Pangasinan, Cebu, Panay, Bohol, Butuan, Cotabato, Lanao, and Sulu as well as some polities, such as Ma-i, whose possible location is either Mindoro or Laguna.These polities were either influenced by the Hindu-Buddhist Indian religion, language, culture, literature and philosophy from India through many campaigns from India including the South-East Asia campaign of Rajendra Chola I, Islam from Arabia, or were Sinified tributary states allied to China. These small maritime states flourished from the 1st millennium. These kingdoms traded with what are now called China, India, Japan, Thailand, Vietnam, and Indonesia. The remainder of the settlements were independent barangays allied with one of the larger states. These small states alternated from being part of or being influenced by larger Asian empires like the Ming Dynasty, Majapahit and Brunei or rebelling and waging war against them.The first recorded visit by Europeans is Ferdinand Magellan's expedition who landed in Homonhon Island, now part of Guiuan, Eastern Samar on March 17, 1521. They lost a battle against the army of Lapulapu, chief of Mactan, where Magellan was killed. Spanish colonialism began with the arrival of Miguel López de Legazpi's expedition on February 13, 1565, from Mexico. He established the first permanent settlement in Cebu. Much of the archipelago came under Spanish rule, creating the first unified political structure known as the Philippines. Spanish colonial rule saw the introduction of Christianity, the code of law, and the oldest modern university in Asia. The Philippines was ruled under the Mexico-based Viceroyalty of New Spain. After this, the colony was directly governed by Spain. Spanish rule ended in 1898 with Spain's defeat in the Spanish–American War. The Philippines then became a territory of the United States. U.S. forces suppressed a revolution led by Emilio Aguinaldo. The United States established the Insular Government to rule the Philippines. In 1907, the elected Philippine Assembly was set up with popular elections. The U.S. promised independence in the Jones Act. The Philippine Commonwealth was established in 1935, as a 10-year interim step prior to full independence. However, in 1942 during World War II, Japan occupied the Philippines. The U.S. military overpowered the Japanese in 1945. The Treaty of Manila in 1946 established the independent Philippine Republic.