Revolts against Spanish rule had been endemic for decades in Cuba and were closely watched by Americans; there had been war scares before, as in the Virginius Affair in 1873. By 1897-98 American public opinion grew more angry at reports of Spanish atrocities, and, after the mysterious sinking of the American battleship Maine in Havana harbor, pushed the government headed by President William McKinley, a Republican, into a war McKinley had wished to avoid. Compromise proved impossible; Spain declared war on April 23, 1898; the U.S. Congress on April 25 declared the official opening as April 21.
Although the main issue was Cuban independence, the ten-week war was fought in both the Caribbean and the Pacific and was notable for a series of one-sided American naval and military victories. The outcome by late 1898 was the Treaty of Paris which was favorable to the U.S., followed by temporary American control of Cuba and indefinite colonial authority over Puerto Rico, Guam and the Philippines. The defeat and subsequent end of the Spanish Empire was a profound shock for Spain's national psyche. The victor gained several island possessions spanning the globe and a rancorous new debate over the wisdom of imperialism.