US President Barack Obama has leapt to the defence of Chancellor Angela Merkel, saying the German leader, facing fire at home over a record refugee influx, is on the "right side of history".

Key points: Mr Obama talks Islamic State, Syria and Ukraine with Ms Merkel

Mr Obama talks Islamic State, Syria and Ukraine with Ms Merkel US leader's final official visit to Germany

US leader's final official visit to Germany Ms Merkel calls for agreement on Syrian humanitarian zones

"What's happening with respect to her position on refugees here, in Europe, she's on the right side of history on this," Mr Obama said on his fifth and final official visit to Germany.

Lauding Ms Merkel for taking "very tough politics not just to express a humanitarian concern but also a practical concern", the US leader said: "She is giving a voice to the kinds of principles that bring people together rather than divide them."

Ms Merkel has faced virulent criticism in Germany over her liberal stance after 1.1 million asylum seekers arrived in Europe's top economy last year.

Critics, particularly from within her conservative camp, argue that Germany is ill-equipped to cope with the sheer scale of the arrivals.

Germany is the last stop on a six-day foreign tour where Mr Obama has sought to shore up US alliances he views as important to increase trade, defeat Islamic State militants and counter Russian intervention in both Syria and Ukraine.

Mr Obama said he was worried about a surge in violence in Syria, where government forces have stepped up bombing of rebel-held areas around the strategic city of Aleppo.

"We remain deeply concerned about the upsurge in fighting in Syria over the last several days, and we continue to agree that the only real durable solution is a political solution that moves Syria towards an inclusive government that represents all Syrians," he said.

Ms Merkel urged parties to peace talks in Geneva, which are at risk of collapse, to agree on humanitarian zones where fleeing Syrians could feel free from bombardment.

Obama condemns North Korea's 'provocative behaviour'

Ms Merkel and Mr Obama made clear that they did not favour the creation of classical "safe zones" which would need to be protected by foreign forces.

The two leaders, who have developed a strong, pragmatic relationship after a rocky start in which Ms Merkel refused to allow Mr Obama, then a senator campaigning for the presidency, to speak at the Brandenburg Gate in 2008, touched on a range of issues, including Ukraine, North Korea, Libya and free trade talks.

Both leaders expressed concerns about violations of a ceasefire in eastern Ukraine and said sanctions against Russia, imposed by the West in response to Moscow's intervention there, could not be eased before the situation on the ground improved.

Mr Obama was also asked about North Korea's latest demonstration of military might — a submarine-launched ballistic missile test that Pyongyang described on Sunday as a "great success".

"What is clear is that North Korea continues to engage in continuous provocative behaviour, that they have been actively pursuing a nuclear program, an ability to launch nuclear weapons," Mr Obama said.

"And although more often than not they fail in many of these tests, they gain knowledge each time they engage in these tests."

AFP/Reuters