BERLIN — The only televised debate between Chancellor Angela Merkel and her main challenger, Martin Schulz, before German elections later this month appeared not to sway many undecided voters on Sunday about who should be their next leader.

Mrs. Merkel and Mr. Schulz clashed in the 97-minute exchange on refugee policy, Turkey and domestic security. She agreed with his statement that Turkey should not become a member of the European Union, while he expressed doubt about whether President Trump could deal effectively with North Korea’s nuclear provocations.

Polls released by Germany’s public broadcasters afterward declared Mrs. Merkel the winner. But polls also have shown that many voters remain uncertain about who could better lead them over the next four years — and there are three weeks to go before they cast their ballots on Sept. 24.

A survey published last week showed that nearly half of all German voters, 46 percent, remained undecided. Winning their support will be crucial for each candidate.