BERLIN—Germans are going to the polls on Sunday for a crucial election that will determine how Europe responds to its mounting economic challenges and growing geopolitical isolation.

Whoever wins the election and heads the next government will need to fix the country’s broken economy, now facing a third year of recession, end a slow-burn immigration crisis that has polarized the country and help Europe find its voice at a risky juncture for the region.

President Trump has threatened the European Union with tariffs. His administration has hinted that it might scale back U.S. military presence in the region despite Russia’s mounting aggression, and Vice President JD Vance has accused Germany’s mainstream parties of stifling free speech by ostracizing the far right.

With the French and German governments on the back foot after losing their parliamentary majorities, the duo that has traditionally steered Europe on the global stage has yet to formulate a coherent response.

Friedrich Merz, leader of the largest German opposition party, the center-right Christian Democratic Union, hopes to change this as head of the next government. Opinion polls have been remarkably stable in recent weeks. Surveys released in the past 10 days show the CDU in line to receive 28% to 32% of votes, ahead of its main challenger, the far-right Alternative for Germany, or AfD, with 20% to 21%.

“It’s time the German government and the German chancellor finally reclaim a leadership role in Europe,” Merz told supporters at a rally this past week. “If the U.S. stays a democracy, and I hope it does…it will need partners,” Merz, a longtime trans-Atlanticist, added in a jab at the Trump administration.

With no chance of securing an absolute majority, a victorious Merz won’t be able to govern on his own. And despite his commanding lead, the exact shape of a potential Merz-led coalition government is highly uncertain.

This is because even minor deviations in the distribution of parliamentary seats could severely complicate coalition negotiations. The more small parties break past the 5% threshold needed to enter parliament, the more difficult it will be for the bigger parties, including the CDU and its potential partners, to cobble together a parliamentary majority.

“Who actually ends up governing the country after Feb. 23 is therefore completely open, despite relatively little movement in the overall political climate,” Manfred Güllner, head of the Forsa polling group, wrote in a note.

One of the big winners is likely to be the AfD, which polls suggest could double its 2021 vote share thanks to an energetic social-media campaign, the outgoing government’s deep unpopularity and an endorsement from Elon Musk.

Merz and the CDU have ruled out governing with the AfD because of its support for Russia, its calls for Germany to leave the EU and its misgivings about Germany’s culture of Holocaust commemoration, so the AfD is poised to lead the opposition.

Whatever the outcome, the victor will be under intense time pressure to form a government. German exporters could face new U.S. tariffs in April. The U.S. has started negotiating with Russia over ending its war in Ukraine on terms most European leaders fear could put the continent at the mercy of Moscow.

Both developments would require a robust European response, and with no resolution of the political deadlock in France expected soon, Berlin needs to step up.

Members of Merz’s team said he wants to cut the length of the coalition negotiations from a recent average of three months down to two to four weeks. He also wants to pare back the traditional coalition agreement, which outlines the government’s policy agenda, to just a few pages, down from the 144-page tome produced by the last government.

Still, if the election returns a highly fragmented parliament, the talks could be tough and long, and could break down.

Merz, a veteran conservative who left politics for a business career in 2002 before making a comeback, has pledged to cut taxes for companies and households, roll back overregulation, cut welfare spending and seek a mutually beneficial trade pact between Europe and the U.S.

Merz has hinted that he might overhaul Germany’s strict fiscal rules, a change he long opposed, to allow growth-boosting investments in the country’s creaking transport, power and digital infrastructure and in its long-neglected armed forces.

Following a wave of violent attacks by migrants, Merz has also pledged to drastically cut the number of refugees flocking to Germany by turning back all undocumented migrants at the country’s borders—a move that could spark conflicts with Berlin’s neighbors.