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.

A hallmark of Merkel's policy has always been pragmatism, rather than pathos or vision. The change in perceptions doesn't mean a change in Merkel's approach, said Manfred Guellner, the head of the Forsa polling agency.

"I think she is acting very pragmatically, as ever — the stream of refugees is there, and she is trying to get a grip on it," he said.

"She is, as always, flying by sight, taking one step after another," he added, and believes that those fleeing violence in their homelands must be helped "so that a negative picture of Germany does not arise."

Asked this week how she feels about the shift in perceptions of her abroad, Merkel said she was "glad Germany has become a country that many people outside Germany associate with hope."

"(But) I don't imagine that this is just about me — this is about the country, the people here, the many who stand at stations and the many who welcome (asylum seekers)," she said.

Merkel has pointed to the possible benefits for prosperous Germany, with its shrinking population, of integrating newcomers: "If we do it well, it carries more opportunities than risks." She has said there will be "no tolerance" for "parallel societies" of newcomers who reject integration, and encouraged women who arrive to learn German along with their children.

Germany's insistence on the paramount importance of EU countries sticking to the rules has irked many during the debt crisis.

And in some ways, that approach is reflected in the migrant crisis. Merkel has rejected Hungary's assertion that it is a purely German problem by noting that the Geneva Convention on protecting refugees applies to every EU nation.

"Germany is doing what is morally and legally necessary, no more and no less," she asserted.

Her government has rejected accusations from others that Germany itself is flouting EU rules by deciding not to send Syrian refugees back to the first EU country they entered. And it is taking a patient, persistent approach to trying to persuade deeply reluctant countries elsewhere in Europe to share the burden of taking in the newcomers.

"We see time and again that there are challenges in Europe in which it comes down to us in particular ... to Germany's strength," Merkel told lawmakers this week in an unusually open acknowledgement of Germany's position as Europe's political leader.

"It is more likely that we will find a European solution if we are courageous and sometimes lead the way," she said.

Merkel drew criticism at home over the summer for initially hesitating to address the migrant crisis, while many ordinary Germans pitched in to help refugees and concerns mounted over attacks on refugee accommodations. That played into a longstanding pattern of Merkel appearing to sit out contentious issues until she has read the political mood.

She initially left the field to her interior minister and vice chancellor before taking the plunge by visiting a refugee shelter in the eastern town of Heidenau, where a far-right mob had hurled bottles and fireworks at police.

Since then, Merkel has made the issue her own, agreeing last weekend to let in thousands of migrants who had piled up in Hungary — something that her government insisted was a one-time measure to ease an emergency.

The influx has shown no sign of abating since. Still, Merkel has the luxury of governing in a coalition of Germany's biggest parties with a huge parliamentary majority and a liberally minded left-wing opposition.

The only significant public criticism of her decision to take in migrants from Hungary so far has come from the Christian Social Union, the often-awkward socially conservative Bavarian sister to her own party, which says the move was a mistake. Merkel has felt able to dismiss that criticism, saying she is "convinced that it was right."

In the same way she insisted the Greek debt crisis would not be solved overnight, Merkel is preparing Germans for the long haul in dealing with the flood of refugees. She stresses there is no legal limit to the number of people fleeing persecution who have a right to asylum, but that those who have no such claim must return home quickly — in particular the many people coming in from the Balkan countries.

"This will be a central challenge, not just for days or months, but as far as we can see for a long time," Merkel said recently. "So it is important to say that German thoroughness is great, but now we need German flexibility."