Spain had granted Puerto Rico almost complete autonomy by 1897, and ceded the colony to the United States in 1898 as a result of the Spanish-American War. The island was under U.S. military rule from 1898-1900. The Jones Act of 1917 made all Puerto Ricans U.S. citizens and created an elected senate. Prior to this, the governor and legislature were federally appointed. Puerto Rico did not elect its own governor until 1948. The Commonwealth of Puerto Rico was established in 1952.