‘Pride goeth before destruction,” Proverbs 16:18 reminds us, and so it was in this election.

The evidence is mounting that President Obama’s overzealous defense of his “opening Cuba” gambit cost Hillary Clinton the state of Florida. That misstep could end up wiping out most of the president’s carefully curated “legacy” achievements.

For the president and his young Deputy National Security Adviser Ben Rhodes, the establishment of diplomatic relations with one of the world’s last communist dictatorships became something they weirdly defended from any criticism. Even the smallest amendment that watered down coddling the Castros drew fulminating threats of vetoes from the White House.

Then in late October, President Obama went for broke and decided to stick a bigger needle in his opponents’ eye.

He lifted limits on the import of cigars and rum, and then ordered our ambassador to the United Nations to abstain from a vote condemning the US economic embargo on Cuba.

That UN directive was especially galling. President Obama was, in fact, venting his frustration with Congress for not lifting the embargo upon his command — which Congress has the right to refuse to do — by letting the world body mock US law unopposed.

The Cuban-American community in Miami was irritated enough to give a second look to Donald Trump, who quickly reacted by shifting from his earlier tepid support for Obama’s Cuba policy to a promise that he would end relations unless Raul Castro began democratic reforms.

A New York Times-Siena poll, headlined “Cubans Come Home to Trump,” confirmed that all this was enough to add almost 20 percentage points to Trump’s support among Cuban-Americans.

Trump voters in this group shot from 33 percent in September to 52 percent just a few days before the election, according to the poll. And there is evidence they may have voted even in larger numbers for Trump.

Various exit polls put Cuban-Americans as supporting Trump over Clinton by a 53-41 percent clip, while analyses of Cuban-American precincts puts the support closer to 60-40.

Clinton ended up losing the election to Trump by the razor-thin margin of 125,000 votes out of more than 9 million cast, in a state where Cuban-Americans number more than a million.

As of today, Trump won the presidency with 290 electoral college votes, which means that Florida with its 29 votes was decisive in putting him over the top.

Why did the president feel he could take such steps without endangering Clinton’s chances in Florida? He misinterpreted a poll by Florida International University which showed strong support for his policies among Cuban-Americans.

The poll included such findings as “sixty-three percent of respondents oppose the continuation of the embargo” and “most respondents favor expanding economic relations between companies in the United States and the island.”

The problem was, when you broke down those responses by the wave in which exiles entered the US — 1960-1980, 1980-1994, or 1994-2016 — the results varied greatly. The first two waves, especially the 1960s crowd, are staunch anti-communists; on principle, they did not want to deal with the Castros. The latter wave, more likely to be economic migrants with no fixed political philosophy, are eager to deal with the government of the country they just left.

Only 36 percent of the first group want to expand business relations with Cuba’s government, for instance, while twice as many — 73 percent — of the latter group do.

There is another difference among these groups: 98 percent of the first wave are American citizens, and 97 percent are registered to vote.

The equivalent figures for the 1994-2016 wave are 53 percent and 43 percent. In addition, the older wave tends to be single issue voters — and the issue is relations with Cuba.

President Obama seems not to have realized these differences existed, or if he did, he may have thought that personal charisma or force of personality would preclude paying an electoral penalty.

Andres Oppenheimer, the Miami Herald’s top columnist, wrote wryly: “I wonder what Obama was thinking when he signed the Cuban rum and cigars order — a largely symbolic measure — and when he voted to abstain on the embargo at the UN, just a few weeks before the US elections. What was the rush to press the normalization pedal just now?”

Hubris goeth before the fall.

Mike Gonzaelz is a senior fellow at the Heritage Foundation.