Tuesday’s Massachusetts Democratic primary, in which Sen. Edward J. Markey thrashed Rep. Joe Kennedy, was decided 19 months ago.

On Feb. 7, 2019, Markey introduced a resolution outlining the Green New Deal, sponsored in the House by Rep. Alexandria Ocasio-Cortez (D-N.Y.). Suddenly, an old warhorse had transformed himself into a cause, a hero to younger voters, maybe even a political hipster.

The campaign’s killer sound bite belonged to AOC: “It’s not your age that counts,” said the politician born in 1989, 13 years after Markey was first elected to the House. “It’s the age of your ideas.”

Thus did the 74-year-old Markey do what many thought was impossible: He defeated a member of the Kennedy clan after its string of 26 Massachusetts primary victories going back to 1946.

So strong was the Kennedy magnetism in days past that for a Gillette stockroom supervisor named John F. Kennedy — no relation to the wealthier lot — simply getting himself on the ballot for state treasurer in 1954 was enough to win him three terms. (Charisma by association finally failed him when he ran for governor in 1960.)

But fascination with the Kennedy Mystique should not cloud the important message out of Massachusetts: The progressivism of the young is now dyed deep green.

It’s been clear for a while that the word “socialism” is no longer a dealbreaker for younger voters. If the old associate it with the oppression of the Soviet Union, the young think of it as describing Denmark or Norway — lovely, livable places with decent social programs. And the young left, as AOC knows, sees climate change as a decisive voting issue because it’s the existential challenge of our time. This is also increasingly true among older Democratic middle-class suburbanites and city voters living in the rehabbed neighborhoods of lofts and exposed brick.

Markey’s victory follows the spectacular rise in the fortunes of Green parties in Europe, particularly in France and Germany. Green politics is displacing the politics of the older left — one reason the ailing French Socialist Party is looking for survival though an alliance with environmentalists.

But, yes, politics is local, too, and Markey, the son of a milkman, became the hero of Greater Boston’s suburban liberals, overwhelming Kennedy by 3 to 1 in Lincoln, better than 2 to 1 in Brookline, and by nearly as much in Newton, Natick and Weston. (Markey won Cambridge, home to Harvard University, by nearly 4 to 1.)

Kennedy carried the older mill towns — among them Springfield, Lynn, Fall River, Chicopee and Worcester — but not by enough to avoid an 11-point loss. The pattern echoed the 1968 Democratic presidential primary battles between suburban liberals who rallied to Sen. Eugene McCarthy (Minn.) and the White-working-class and minority voters who embraced Robert F. Kennedy, Joe Kennedy’s grandfather.

This generation’s Kennedy, with a gift for connecting with people, had many reasons to think he could beat Markey. As recently as a month ago, polls showed Kennedy within reach of victory.

And the 39-year old Kennedy, looking down the road and pondering the talented bench of other Democrats in his state — among them Rep. Ayanna Pressley and Attorney General Maura Healey — figured it was better to take a one-on-one shot against Markey now than to wait his turn.

Polling suggested that Markey, who won a special election in 2013 held after Sen. John F. Kerry was named secretary of state, had not made a particularly strong impression on the state and seemed to many voters as more Washington than Malden, his working-class hometown. Kennedy promised a whirlwind of energy and pledged to pay close attention to local and constituent needs. Other longtime incumbents had been knocked out. Why not Markey?

Yet, beyond offering vigor and a voice for the future, Kennedy never provided a clear rationale for why he was running or why Markey should be fired. In the meantime, Markey made a powerful case that he has been an anti-establishment figure since his days as a rebel in the state legislature. And he built a record as a longtime ally of environmentalism and other causes associated with the young — from the nuclear weapons freeze in the 1980s to net neutrality.

Not everything went the progressives’ way in Tuesday’s primary: Longtime Massachusetts House members Richard E. Neal and Stephen F. Lynch survived vigorous challenges from their left. You could say it was a good night for older incumbents. That shouldn’t obscure what Markey achieved.

Don’t count Kennedy out forever; bringing the legacy down a peg may, paradoxically, increase his popularity. But Markey’s triumph really was, as he proclaimed in his victory speech, “a celebration of a movement.” He’ll now always be known for working a political miracle — and for making clear, to borrow from JFK, that saving the planet is this generation’s long twilight struggle.

Read more: