The ten week Spanish–American War of 1898 was fought both in the Caribbean and the Pacific. The war was primarily due to American involvement in the Cuban War of Independence. Decades of Cuban revolts against Spanish rule had been closely watched by the United States and by 1897–98, American public opinion had solidified because of the Spanish atrocities that had been reported. After the battleship Maine mysteriously sank in Havana harbor, political pressure in the United States came to a head and forced the hand of President McKinley into a war he had hoped to avoid. When a compromise couldn’t be reached, the United States sent an ultimatum demanding that Spain immediately surrender control of Cuba. The ultimatum was rejected. Madrid declared war, and then on April 25, 1898 Washington formally declared war.