Democratic presidential candidate Bernie Sanders released an ad Monday invoking the legacy of President John F. Kennedy. But in previous remarks, Sanders harshly criticized Kennedy and said the former president nauseated him.

The Sanders ad, set to air in Iowa ahead of the February caucus, opens with footage of Kennedy promising to put a man on the moon. "President Kennedy knew settling for half-measures wasn't good enough," Sanders says. "So when candidates say we can’t guarantee health care for all, make college affordable for all, combat climate change, or create a world at peace, remember America is best when we strive to do big things, even when it’s hard."

The praise of Kennedy marks a radical departure from Sanders's previous rhetoric about the president. In a 1987 interview with the University of Vermont student paper, The Gadfly, the socialist candidate remembered Kennedy as the start of his disillusion with mainstream liberalism. "President Kennedy was elected while I was at the University of Chicago, that was 1960. I remember being physically nauseated by his speech and that doesn’t happen very often," Sanders said.

Sanders told the student paper that he was particularly repulsed by Kennedy's opposition to Fidel Castro's revolution in Cuba. "Kennedy was young and appealing and ostensibly liberal, but I think at that point, seeing through Kennedy, and what liberalism was, was probably a significant step for me to understand that conventional politics or liberalism was not what was relevant," he said.

The then-independent Burlington mayor told the same story in a 1986 speech at the University of Vermont, setting the story during the 1960 Kennedy-Nixon debate rather than a Kennedy speech.

"I was very excited and impressed by the Cuban Revolution, and there was Kennedy and Nixon talking about which particular method they should use about destroying the revolution," Sanders recalled. "Usually I'm sufficiently unemotional not to be sick, but I actually got up from the room and almost left to puke because, for the first time in my adult life, what I was seeing is the Democrats and Republicans, both of them … clearly there really wasn’t a whole lot of difference between the two."