For years, President Barack Obama faced a tough problem: what to do about Alan Gross, the US subcontractor imprisoned in Cuba? And this dilemma encapsulated the larger puzzle of how to change US-Cuba relations, which have been frozen in a Cold War narrative.

The Cubans arrested Gross in 2009 and threw him in jail for distributing internet communications equipment under a program funded by the US Agency for International Development. The Cubans claimed he was a spy helping dissidents set up a secret communications system; the Obama administration insisted he was no such thing and was merely promoting free expression within Cuba’s Jewish community. After Gross, who was in poor health, was sentenced to 15 years in prison, the Cubans offered the Americans a deal: They would free Gross if the United States released the Cuban Five, five Cubans arrested for spying in 1998 in Florida and later convicted and given long prison sentences. (One of the five was paroled in 2011; another comes up for parole in February.)

The Obama White House balked at the deal, in part because it seemed to equate Gross’ activity with espionage. For years, Gross and his family and his advocates slammed the administration for not doing enough to secure his freedom. Some privately complained bitterly about White House inaction. Gross, they noted, had been sent to Cuba on a mission for the United States—which might indeed have crossed a line—but was left to rot on his own. A year ago, Gross sent Obama a letter and said he feared he had been “abandoned.” He called on the president to intervene personally to win his freedom.

But White House officials, insisting that Gross was not an intelligence asset, felt they could not accept the Cuban terms. There would be no spy swap. And the political uproar that accompanied the trade of Army Sgt. Bowe Bergdahl for five Taliban commanders earlier this year hardly encouraged the administration to reconsider.

There was a deadlock. Yet someone on the Cuban or American side came up with an ingenious workaround. It turns out that a US intelligence asset—who provided intelligence that helped the United States apprehend the Cuban Five—had been held in a Cuban prison for years. This person could be the other end of the swap. Consequently, Obama agreed to trade the remaining Cuban Five for this person—which isn’t a bad deal. And at the same time—coincidentally?—the Cubans released Gross on “humanitarian” grounds. Presto! On Wednesday morning, Gross boarded a US government plane and began the short flight back to the United States.

Gross’ departure from Cuba did not only mark the end of his own tragic tale; it opened up a new era for US-Cuba relations. It was no secret that Obama and his foreign policy team had long been interested in a reset. The president cannot end the US embargo on Cuba on his own because it has been congressionally imposed. But he could expand exceptions to the embargo and widen a variety of paths for US-Cuban interactions, including cultural and commercial activity. With the Cubans holding an American citizen, the White House could not make a move in this direction.

But as Gross flew toward freedom, word leaked out that Obama, within hours, would announce he was taking steps to reestablish diplomatic relations with Cuba and set up an embassy in Havana. He also would allow Cuban Americans to send more money to relatives on the island nation and weaken provisions of the embargo to allow for more US travel to Cuba and increased (but still limited) US commerce there.

The Gross affair was never about just one man. And while Gross and his allies justifiably believe he was screwed over by Washington and treated as a pawn by the repressive government of Havana, Obama and his crew were eventually able to use this episode to mount a bold and larger move: shifting an ineffective policy that was a Cold War relic and pivoting to greater engagement with more of a chance of bringing democratic change and economic opportunity to Cuba. No doubt, the anti-Castro crusaders and their partners in Congress will howl. (How dare the president engage in…foreign relations!) But their protests will lack the punch of yesteryear. Obama has deftly engineered a historic change in policy. It’s unfortunate Gross was caught in the middle and his life endangered. But an unfortunate pawn has been traded for a queen.