John F. Kennedy never met Ernest Hemingway, but the two men influenced each others’ lives and legacies.

“President Kennedy more than once expressed his admiration for Hemingway and his work,” writes the John F. Kennedy Presidential Library and Museum, even going so far as to quote the author in the preface to his book, Profiles in Courage. Hemingway was invited to attend Kennedy’s inauguration in 1961, but was too ill to attend. However, after he died just months later in July, the new President had the opportunity to be of service to the writer’s legacy.

Hemingway had lived in Cuba on and off since the 1940s. In 1960, writes Jon Michaud for The New Yorker, he left Cuba for good. The Cuban Revolution had concluded with Fidel Castro’s rise to power the year before and it wasn’t clear if he was safe there and was free to come and go. When he left, writes the JFK Library, a large part of Hemingway’s personal effects and his literary estate stayed at Finca Vigía, the farmhouse that the writer and his third wife Martha Hemingway had bought in 1940. The question was how to get those things back.

1961 was an important year in U.S.-Cuba relations. The Bay of Pigs Invasion in April 1961 had resulted in a travel ban. But Kennedy made a special arrangement for Mary Hemingway, his fourth wife and now his widow, to go to Cuba to retrieve her and Hemingway’s legacy there.

Mary Hemingway met with Fidel Castro in Cuba and managed to arrange the retrieval of of “crates of papers and paintings,” writes the JFK Library, which were shipped back to the United States on a shrimp boat.

As part of this deal, she donated Finca Vigía to Cuba. How voluntary that donation really was remains something of a mystery. The JFK Library says that the deal was an “exchange,” but Hemingway scholars have suggested it may have been more complicated than that. “After the Castro revolution, the house could have been appropriated, as was the case with other U.S. property in Cuba,” literary scholar Susan Beegel told Alison Flood for The Guardian, “but instead the Cuban government approached Mary to request the house as a gift, to be used as a monument to Hemingway.”

A letter written by Mary Hemingway and rediscovered in 2015 suggests that she did intend to donate the property. “I believe that he would be pleased that his property... in Cuba be given to the people of Cuba… as a center for opportunities for wider education and research, to be maintained in his memory.”

Mary Hemingway’s concern with preserving her husband’s legacy also stretched to the United States, where she spent years trying to decide where to place his papers. She contacted Jacqueline Kennedy to offer the Hemingway papers to the JFK Presidential Library and Museum in 1964, the year after Kennedy himself died. The papers are still held there today.

As for Finca Vigía, the house is still a museum.