But the U.S. and Cuba's ties go back well before Castro. In 1898, at the end of the Spanish-American war, a defeated Spain signed the rights to its territories — including Cuba, Puerto Rico and Guam — over to the U.S., which subsequently granted Cuba its independence with the stipulation that the U.S. could intervene in the country's affairs if necessary (later relinquished) and that it be granted a perpetual lease on its naval base at Guantánamo Bay (not). For the next half-century the two countries more or less cooperated, with the U.S. helping to squash rebellions and heavily investing in the economy of its tiny neighbor. The American mafia used Havana as a conference center in 1946. Ernest Hemingway lived there for 22 years; he wrote The Old Man and the Sea at his villa just outside the capital.