(CNN)German Chancellor Angela Merkel traded blows with her election rival, Martin Schulz, in a live TV debate Sunday night, three weeks before the country's federal election.
Merkel and Schulz spar over North Korea, refugees
The pair sparred over the right course of action in North Korea after Sunday's nuclear bomb test.
President Donald Trump "is not the right person to solve this conflict," said Schulz, leader of the Social Democratic Party, or SPD.
"Last time, by tweeting, he brought us to the brink of a crisis."
Germany will need to work with other partners, including Canada, to solve this crisis, Schulz continued. "The problem we have with Trump is that he is unpredictable ... we never know when he will tweet next time."
He later likened Trump to Turkish President Recep Tayyip Erdogan, arguing both leaders question democratic values.
Merkel responded to the question of North Korea with more caution. "I don't think we can solve this without the US President, but we will only consider a peaceful, diplomatic solution," she said.
"We need the US as a power for peace," she said, "and we need to do everything possible to get them on the right and sensible path."
Sunday night's encounter, the only head-to-head debate of the campaign, had been billed as a moment of potential peril for the Chancellor and a moment of opportunity for Schulz.
More than 16 million Germans tuned in to watch, according to the Forsa Institute.
Merkel is running for her fourth term in office and polls show her Christian Democratic Union Party, or CDU, as the clear front-runner in the September 24 vote. But Merkel is not naturally combative and has been criticized for barely mentioning her opponent's name during the campaign.
She was also accused of threatening to boycott the so-called "duel" if the question-and-answer format was changed to allow the candidates to debate each other directly.
Merkel did not deny that claim when questioned about it at her annual press conference last week.
While debating is not Merkel's forte, her opponent has shown plenty of rhetorical firepower on the campaign trail.
Schulz also has less to lose, with polls showing his party 10 to 15 points behind Merkel's conservatives.
Little known to most German voters before he was elected party leader in January this year, he was looking to make a strong impression in the debate.
The pair were questioned in a studio in Berlin over 90 minutes by two sets of moderators.
Despite the question-and-answer format, which limited the amount of direct combat between the candidates, there was plenty of heated debate.
As well as addressing domestic issues such as social inequality, pensions and education, they clashed on a series of topics with broader implications.
Schulz took a harder line than his rival on Erdogan. Relations between Germany and Turkey have deteriorated significantly in recent months.
Negotiations for Turkey's accession to the European Union must be stopped, he said.
"All our basic values are called into question," by Erdogan's regime, he continued.
He also called for accession payments to Turkey to be stopped, describing Erdogan as an "autocratic ruler."
"Germany needs to let Turkey know that all red lines have been overstepped," he said.
Merkel agreed that accession negotiations should be paused but insisted that "we need to continue talking" with Turkey.
"I do not want to stop diplomatic relations with Turkey," she said.
The debate opened with a series of questions on Merkel's refugee policy, for which she has been widely criticized after 1 million refugees entered the country in 2015.
Integrating these refugees is "a very big task," Merkel admitted -- but defended her decision to allow an indefinite number of refugees into Germany in September of that year.
Schulz criticized that decision, arguing that Merkel should not have acted without support from other European countries. "People who flee from ISIS, from mass rape and mass violence, come here and we are ready to protect them," he said. "We are proud of that in Germany."
We cannot and we should not close Europe's outer borders, he said. But "in terms of migration, we face great challenges."
"Integration is the task of a generation."
Schulz also promised to speed up deportations of those asylum seekers who do not have the right to stay in Germany, but argued against mass deportations, insisting that cases should always be assessed on an individual basis.
"We must not get used to terror and we need to confront it," said Merkel when asked about the rise in the number of terror attacks across Europe.
"We need to do everything possible to learn from our mistakes," she said, referring to the truck attack in Berlin in December in which 12 people were killed.
The perpetrator, Anis Amri, was supposed to be in pre-deportation custody at the time of the attack.
Schulz agreed there were many mistakes and said Germany needs to take all preventive measures to stop people from becoming a risk.
Merkel defended the majority of Muslims in Germany, saying that many contribute to the country's success and are part of German society.
"The Islamic community needs to make clear that (Islamist terrorism) has nothing to do with Islam," she said.
But she said the training of imams within Germany needed to be improved and that mosques should be closed "if things happen that we don't accept."
Schulz acknowledged that some newcomers from Muslim countries may have a different set of values and stressed the importance of education, both in schools and in vocational training programs.
The country's auto industry has taken a hit since Volkswagen admitted two years ago that 11 million of its cars worldwide were fitted with software that allowed it to cheat pollution tests.
The crisis unfolded under Merkel's watch and Schulz criticized the Chancellor for being too slow to address it.
He heaped blame on the car industry, too. "The damage they have caused is immense," he said.
Merkel admitted that "trust has been breached."
"We need to make sure that the carmakers right their wrongs," she said.
Cars and auto parts account for roughly one-fifth of all German exports, worth €260 billion ($309 billion). The sector employs over 800,000 people.