Whatever happens next, it’ll go down as one of the wildest gambles in modern French history. President Emmanuel Macron’s decision to dissolve the National Assembly and hold snap legislative elections on June 30 and July 7 has given the far right its best shot at governing France for the first time since the Vichy regime of World War II.

The move stunned the country’s political class, including high-ranking Macronists from whom the president’s plans were reportedly heavily guarded. And for much of France, the decision remains perplexing. For those with the most to lose from the far right in power — above all, immigrants and the descendants of recent immigrants — the news is downright terrifying. Mr. Macron, who has a habit of disregarding conventional wisdom, will surely hope the move redounds to his benefit. But make no mistake: France is in danger.

In many respects, Mr. Macron’s domestic agenda was already in crisis. Since the 2022 legislative elections denied his electoral alliance a majority in the National Assembly, his coalition has been forced to seek support from other parties, namely the right-wing Republicans. At times, the government bypassed Parliament altogether. But for the bulk of its work, the administration was dependent on the Republicans’ backing.

The historic triumph of Marine Le Pen’s National Rally in Sunday’s elections for the European Parliament — in which her party took 31 percent of the vote, more than double that of the president’s party — threatened this arrangement. Without a dissolution of the National Assembly, the National Rally would have continued to ramp up pressure on the Republicans, aiming to woo conservative voters and punish Republican leaders for their tacit support of the president. The prospect of a lame-duck presidency would have only grown.

The new elections are an attempt to salvage Mr. Macron’s second term. And he may genuinely believe voters will deliver him a fresh parliamentary majority, hoping his base of old and wealthy voters will once again show up to the polls in much greater numbers than the young and working-class voters who are less sympathetic to his presidency. Lingering animosity among various left-wing parties and a generalized fear of the far right coming to power could also play in his favor.

But there is a more cynical way of viewing Mr. Macron’s wager. As France’s far right continues to gain traction — its various obsessions propelled by a newly sympathetic media landscape and, in some cases, even inspiring pieces of legislation — it is increasingly favored to win the 2027 presidential election. Against this backdrop, Mr. Macron’s tactic can also be seen as an effort to derail the National Rally’s march to the Élysée Palace by, counterintuitively, forcing the party to govern.