Angela Merkel clashed with her Social Democrat rival, Martin Schulz, in a lively television debate on Sunday evening widely seen as the last opportunity for the chancellor’s opponent to claw back support before a crucial election in three weeks’ time.

With latest polls showing Merkel’s Christian Democrats (CDU) and her partners in Bavaria’s CSU ahead of Schulz’s SPD by 15 to 17 points, but with half of voters said to be undecided, the primetime face-off was seen as Schulz’s best chance to influence the outcome and halt a fourth term for Merkel.

The candidates sparred over 90 minutes on topics ranging from migration and foreign policy to social justice and home security, in what was their only televised confrontation before Germans go to the polls on 24 September.

Quick Guide German elections 2017 Show What's the story? Germany goes to the polls on 24 September in national elections that will return a new parliament and decide whether Angela Merkel remains chancellor for a fourth consecutive term. What are the issues? Immigration and national security have been prominent, in the wake of Merkel’s decision to open Germany's doors to refugees and migrants in 2015. On the economy, Germans are enjoying near-record low unemployment rates, but there are concerns over the country's ailing infrastructure. What do the polls say? Merkel's centre-right Christian Democratic Union is polling at up to 40% with its Bavarian sister the Christian Social Union. The centre-left Social Democratic Party, led by the former European parliament president Martin Schulz, is heading for 23-25%. Four smaller parties should get more than 5%: leftists Die Linke; the free-enterprise, pro-business Free Democrats; the Greens; and the Eurosceptic, nationalist Alternative für Deutschland. Read more

One in five of Germany’s 60 million voters said ahead of the debate that it could help decide how they would vote. With between 20 and 30 million expected to tune in to the event – which was broadcast simultaneously on four channels – it was broadly seen as the highlight of what has so far been a low-key campaign.

Viewers polled after the clash found Merkel significantly more convincing than Schulz: 55% said Merkel was the stronger candidate, compared with 35% for Schulz. Those figures make this the strongest performance for Merkel in all the TV debates she has participated in since 2005.

Schulz, who has blamed Merkel for a dull election campaign in which he said she had anaesthetised voters with her equivocal answers to pressing questions, was swift to attack the chancellor for aspects of her open door policy two years ago which saw almost a million migrants coming to Germany.

The migration issue became the central issue of the discussion with Merkel forced on to the defensive when Schulz accused her of failing to involve Germany’s European Union partners in the decision.

Merkel responded by saying she had had little choice and that she was unable to contemplate a situation where she would have closed Germany’s borders. She said that while mistakes had been made, she would take the same decision again.

Other tense moments focused on growing inequality in Germany, with Schulz accusing Merkel of ignoring concerns over growing living costs, including rising rents and sinking wages, and criticising the government for its continued support of the car industry despite the scandal over diesel emissions.

In the debate, Schulz accused his rival of “protecting motor industry executives” and claimed that even two-income families could not afford fast-rising rents.

He also took the opportunity to repeat the SPD’s rejection of the CDU’s plans to double Germany’s defence budget.

But his main challenge proved to be distancing his party from Merkel’s CDU, despite the fact that the two parties have been partners in grand coalitions twice under Merkel’s leadership, between 2005 and 2009 and during the past four years. Despite Schulz’s attempts to create clear policy differences, their opinions frequently appeared very similar.

Schulz also said he would end talks with Turkey about joining the EU because of Turkish president Recep Tayyip Erdogan’s increasingly authoritarian policies.

Merkel, who has previously expressed doubts about Turkey ever joining the EU, refused to commit to the same move, but sharply criticised Erdogan’s rule, saying that “Turkey is departing from all democratic practices at breakneck speed.”

In a photomontage, the weekly newspaper Die Zeit had depicted Schulz dressed as a workman gleefully waiting to saw into the throne of Queen Angela, despite the lack of expectation that he will manage to topple her from her position as Europe’s longest-serving leader. He had been billed as a potential successor to Merkel as recently as January this year, when his decision to stand as the SPD’s candidate initially proved highly popular.

Schulz, the former European parliament chief with a 23-year career in transnational politics behind him, appeared relaxed. Merkel was typically composed, but occasionally appeared impatient in response to the four presenters and the questions they put to her.

Before the debate, her office had been criticised for determining the rules of the confrontation’s format after she threatened to boycott it if the broadcasters carried out their plans to change it to introduce more profundity and more of a sense of spontaneity.

Political observers said a more laid-back debate could benefit Schulz, who scores points for his man of the people image, compared with Merkel’s schoolteacher persona.

Several hundred journalists who gathered at the TV studio in Adlershof, east Berlin, were intensively briefed before and after the debate by advisers from both the Merkel and Schulz camps. According to Die Zeit, the clash would decide “whether the end of the debate marks the final whistle for the campaign, or the kick-off for an exciting three weeks”.

Pollsters closely watching the confrontation have said it could prove crucial for those yet to decide how they will vote. One said 17% would vote “according to their stomachs”, with many being swayed by how sympathetic they found the candidates as well as who appeared more authentic.

During Merkel’s last TV debate, four years ago against the SPD’s Peer Steinbrück, the major talking point on talkshows and social media was not the contents of the discussion but her necklace, a striking chain in the colours of the German national flag. This time she chose an inconspicuous silver necklace to accompany a royal blue blazer. Schulz wore a plain blue tie and navy jacket.