BERLIN — In the space of two months, German Chancellor Angela Merkel has gone from being portrayed as the heartless villain in Europe’s debt crisis to the heroine of those flooding in to find refuge on the continent.

But while different crises have triggered contrasting perceptions of the German leader, Merkel’s behavior has appeared consistent: a first-unhurried, then decisive approach to the challenge; an insistence that Europe must abide by international rules; an eye on public opinion at home; and hope that German leadership will help bring about a European solution.

Merkel hasn’t pleased everyone in Europe with her approach to either crisis. Several countries that backed her insistence on tough conditions for Greece’s new bailout, such as the Baltic nations and Slovakia, are now on the other side of the argument over whether to welcome refugees to Europe.

But the 61-year-old is undaunted, and her enduring domestic popularity is holding up as she approaches her 10th anniversary in office in November. That longevity has been based partly on her knack for convincing Germans that she is on top of complicated crises and taking account of their worries – something that has earned her the nickname “Mutti,” or “Mom.”

Her insistence that Germany and its fellow members in the 28-nation European Union all have a duty to shelter people fleeing civil wars has cemented something similar among hopeful migrants.

Some have held aloft pictures of Merkel, and she was greeted with applause and cheers at a Berlin refugee home Thursday. It remains to be seen how far that adulation holds up after the government announced Sunday that it was introducing border checks to limit the influx.