MIAMI — Stirred by breathless warnings of a socialist menace, Cuban Americans turned out for President Trump in massive numbers. Now those voters are presenting a new challenge for President-elect Joe Biden: how to reembrace the historic Obama-era opening with communist Cuba without ceding Florida to Republicans in 2024.

On few countries is U.S. foreign policy driven more by domestic politics than Cuba and, to a lesser degree, Venezuela. Exiles and Americans of Cuban and Venezuelan descent who harbor deep antipathy for the governments of those leftist police states helped Trump win this key swing state this month. Trump’s net gains in South Florida’s Cuban community alone, experts say, accounted for as much as a third of the 372,000 votes that cost Biden the state.

But Biden is gambling that a focus on the restoration of flights and remittance privileges removed under Trump — which Miami Cubans have griped about over steaming cups of cafecito — will allow his administration to re-engage Havana without enraging a pivotal segment of the electorate. Ultimately, the failure of Trump’s “maximum pressure” campaigns against leftist authoritarians in Havana and Caracas to provoke significant change could help Biden swing the pendulum back toward detente.

On Venezuela, Biden has signaled no change in sanctions or indictments of top officials, but he has said he plans to focus more on the humanitarian plight of a people suffering under a harsh autocracy. At least in the short term, President Nicolás Maduro is unlikely to enjoy a major break in his international isolation.

The president-elect has signaled more movement on Cuba, tilting back toward former president Barack Obama’s landmark thaw in relations that inspired hopes on the island of a new economic future for struggling Cubans. During the Obama administration, a new crop of restaurateurs, IT entrepreneurs, artists and fashion designers tapped into a short-lived boom in American visitors.

“I think Biden will try to shift the narrative, so that U.S. policy again becomes about flights and money transfers for Miami Cubans to their families, to empowering Cuban artists and entrepreneurs and musicians,” said Collin Laverty, who operates educational visits for Americans. “There’s a hope that it goes back to that quickly.”

In shifting U.S. policy, Biden faces a tough balancing act, particularly given the sudden outbreak in Cuba of an exceedingly rare string of protests that have morphed into the largest act of civil disobedience there in years. The demonstrations were fueled by the arrest this month of Denis Solís, a Havana rapper and government critic sentenced to eight months in jail for insulting a police officer.

The campaign to win his freedom has sharply escalated into a standoff between Havana’s creative community and authorities. This past week, five members of the San Isidro Movement, a group of artists, poets, gay rights activists, academics and journalists to which Solís belonged, had staged a hunger strike to secure his freedom. Late Thursday, Cuban authorities entered the group’s Havana headquarters and forcibly detained 14 people for alleged violations of the island’s coronavirus laws — a charge the group dismissed as a pretext.

Most were released within hours. But the backlash was swift, with hundreds of artists, writers and other activists gathering in front of the Ministry of Culture on Friday and demanding a review of the Solís case as well as more freedom of expression. Ministry officials relented, agreeing to meet with 30 representatives of the group and open a dialogue on at least some demands.

The group’s members say liberty for prisoners like Solís and an insistence on more individual freedoms must come hand in hand with any rapprochement by Washington.

“There are people willing to die for this,” said music producer Michel Matos, one of the movement’s coordinators, about the effort to win the release of Solís. “If this new administration is going to follow Obama’s old policies, giving without asking anything in return, it will be very disappointing.”

During the nearly two years before Trump effectively shut it down, Obama’s diplomatic outreach to Cuba failed to achieve many of its goals, including the release of political prisoners and increased openings for private enterprise. Yet Biden has said his goal is to quickly change what he called “the failed Trump policies that inflicted harm on Cubans and their families,” and allow Americans to travel there as “the best ambassadors for freedom.”

The chance of a return to more open days is reigniting hope on the island, where food lines and the scarcity of goods have grown more severe in recent years, and where fears have escalated over a recent move by the Trump administration to increase already sharp restrictions on remittances to Cuban islanders from their U.S.-based relatives.

“We are so happy and hopeful that things could change for us,” said Nidialys Acosta. The Havana entrepreneur rents out classic cars. She saw a 50 percent drop in business under the Trump-era curbs on American visitors even before the coronavirus pandemic paralyzed tourism. “The day [Biden was declared the winner], we put on some music and fixed ourselves a little drink,” she said. “We were all celebrating.”

Some Cuban entrepreneurs, frustrated with the glacial pace of change in a country still far more economically closed than communist peers such as Vietnam, say Biden should leverage U.S. clout to help formalize rights for business owners. Cuban officials are contemplating the idea in draft legislation to be laid out next year.

“Under Trump, we saw them obliged to move toward a small- and medium-business law because things had gotten so bad,” said Oscar Casanella, 45, who runs a classic-car taxi service in Havana. “Sadly, it’s only when you see outside pressure that you see internal change.”

Obama expanded the categories of U.S. nationals who were allowed to visit Cuba, sending tens of thousands of Americans pouring into Havana. That came to a halt under Trump, who reinstated barriers on flights and cruise ships.

Trump’s Cuba policy, guided by Miami Cuban Americans, including Republican Sen. Marco Rubio (Fla.) and former National Security Council senior director Mauricio Claver-Carone, also limited the number of Cubans allowed to visit the United States.

In 2017, Trump blamed Cuba for a string of cases in which U.S. diplomats and their families in Havana suffered brain trauma, typically after hearing loud, mysterious noises. He winnowed the embassy staff down to a skeleton crew. One impact was that Cubans who wanted U.S. visas now flew to third countries. Trump also expelled 15 Cuban diplomats from Washington.

Biden advisers, speaking on the condition of anonymity to discuss planned policies, said the safety of diplomats would be a primary concern in staffing the embassy in Havana.

Members of the Biden landing team at the State Department include Roberta Jacobson, who participated as assistant secretary for the Western Hemisphere in negotiations with Havana that led the countries to reestablish diplomatic relations in 2015.

Still, Biden aides said measures affecting the Cuban government directly, including lifting of sanctions, would depend on the behavior of the government. The goal, they said, is to begin a conversation, not simply to return wholesale to Obama’s policies. Reopening a diplomatic dialogue, one adviser said, “is not a reward but an opportunity.”

Potential roadblocks run through Miami-Dade County, where Cuban Americans make up almost a third of the electorate. Cuban Americans have long tilted toward the GOP, a trend that has accelerated sharply since 2010: More than 3 in 4 naturalized Cuban immigrants in the past decade have registered Republican.

To win Florida, Democrats must run up massive margins in Miami-Dade to offset redder ground in the northern and western parts of the state. Biden’s failure to do so — he carried the county by only 7.3 percentage points, after Hillary Clinton won it by nearly 30 points in 2016 — was fueled in large part by a Hispanic vote that broke heavily for Trump. A cluster of Cuban-dominated precincts tipped 69 percent for Trump, up substantially compared with GOP results in the past three presidential elections.

Alexander Otaola, a social media influencer in Miami, has organized boycotts against artists he sees as too close to the Cuban government. He criticized Trump in 2016 but has become a staunch supporter, arguing that Democrats have shifted too far to the left.

“People are saying we should be ashamed of voting for Trump,” he said on his YouTube show “Hola! Ota-Ola.” “We need to be proud and we are proud, and we will remain proud of voting like we did and winning Florida for President Donald Trump.”

Yet the incoming Biden administration’s approach might not be as much of a blow to Democrats’ hopes in Florida as the election results suggest. Two-thirds of Florida’s Cuban American community polled by Florida International University in late summer gave high marks to Trump’s Cuba policy. But dig deeper, and the poll suggests opposition to many of the details.

A majority disagreed with the pullback of U.S. Embassy staff in Havana. Majorities support sales of food and medicine to Cuba, reopening air routes to destinations throughout the island and suspending trade sanctions barring U.S. companies from doing business with Cuba while the island copes with the coronavirus.

Opposition remains to permitting a return of cruise passengers or completely opening the island to American tourism. That’s a step Obama didn’t embrace under the embargo, which only Congress can lift. But the data suggests that Republican gains among Cuban Americans, which cost two Democratic congresswomen their seats this month, had far more to do with the constant messaging on Spanish-language radio stations and social media portraying Democrats as socialists soft on Cuban communism and Venezuela’s Maduro.

“Cubans want to visit their families, they want to send them remittances,” said Guillermo Grenier, principal investigator of FIU’s Cuba Poll. “The Democrats have to create a new story for the Cuban Americans, one that’s not about the Cold War but uses the idea that family can be the change agent.”

There’s little expectation that U.S. dialogue with Cuba will reduce Cuban support for Maduro. Cuba’s intelligence agents provide security to the Venezuelan government in exchange for cheap oil. Under Biden, the United States will continue to seek Maduro’s exit and the establishment of a democratic, U.S.-friendly government free from the influence of Cuba, Russia or China.

Biden has said he will try to address humanitarian concerns for Venezuelans, including those in the United States, where he plans to provide temporary protected status for refugees and stop deportations that have occurred under Trump. Those moves could help him with the increasingly significant Venezuelan American vote. His second priority will be to encourage Venezuela’s fractured opposition to unify, rather than compete, for U.S. support.

During the campaign, Trump advocates in Miami warned that Biden would seek a rapprochement with Maduro. But an adviser said the president-elect’s position is unchanged since Maduro approached him during an international gathering in Brazil in 2015, when Biden was vice president.

If Maduro wanted to talk to the United States, Biden said, he needed to meet three conditions: release political prisoners, engage in real dialogue and take emergency economic measures to prevent collapse.

“Until then,” Biden said, according to the adviser, “you need to be talking to your own people, not to us.”

Five years later, Venezuela’s economy has collapsed, millions have fled the country and the number of political prisoners has grown.

DeYoung reported from Washington. Ana Vanessa Herrero in Caracas, Venezuela, contributed to this report.