The city of Havana was founded by the Spanish in the 16th century, and due to its strategic location it served as a springboard for the Spanish conquest of the Americas, becoming a stopping point for Spanish galleons returning to Spain. Philip II of Spain granted Havana the title of capital in 1592. Walls as well as forts were built to protect the old city. The sinking of the U.S. battleship ''Maine'' in Havana's harbor in 1898 was the immediate cause of the Spanish–American War.