By Noah Barkin

BERLIN (Reuters) - Donald Trump's victory has been a shock for America's major partners around the world. But perhaps nowhere has the blow been more painful than in Germany, a country that under Angela Merkel has come to see itself as a bastion of openness and tolerance.

On virtually every issue of importance to the German chancellor, from confronting Russian aggression and promoting free trade, to combating climate change and tackling the tide of refugees fleeing Syria, Trump seems likely to turn Washington from an ally into an adversary.

He invoked the German chancellor's name to insult his Democratic opponent Hillary Clinton during the U.S. campaign, calling her "America's Merkel". And he described her decision last year to open German borders to hundreds of thousands of migrants as "insane".

So although Trump's election is being seen as a rejection of the political establishment and liberal democratic values in general, it represents a very personal blow to Merkel, Europe's most powerful leader.

It heaps more responsibility on her at a time when she is nearing an announcement on whether she will run for a record-tying fourth term as chancellor next autumn.

Despite the toll that 11 years of non-stop crisis fighting has taken on her, Merkel's aides say that Trump's victory and Britain's decision in June to leave the European Union have, if anything, reinforced her determination to continue.

"Given the challenges we face, in Europe and beyond, she can't simply walk off into the sunset. That would look very bad. She has a sense of responsibility," said an adviser.

Germans have been falling out of love with the United States since George W. Bush invaded Iraq more than a dozen years ago. But the election of Barack Obama in 2008 was seen here as proof of America's capacity to correct its "mistakes".

Obama was hailed as the heir to John F. Kennedy, who came to a divided Berlin in 1963, two years after construction of the Berlin Wall began, and reassured Germans with the word "Ich bin ein Berliner". Obama, who developed a close relationship with Merkel in his eight years in office, will make what promises to be a bittersweet farewell visit to Berlin this week.

Trump's win heralds a hard break in a relationship that grew extremely close during the Cold War, before wobbling when Germany refused to go along with Bush's Iraq war and was derided by his Defense Secretary Donald Rumsfeld as "old Europe".

Last week, Germany's Suddeutsche Zeitung published a cartoon of a beaming Trump opening his jacket to reveal the message "Ich bin kein Berliner" (I am not a Berliner) plastered across his chest.

PROVOCATIVE MESSAGE

This won't stop Merkel, a restrained politician who prefers small steps to giant leaps, from trying to work with the brash Trump, who rode to victory on the dreamy promise to "Make America Great Again".

She is a pragmatist who has maintained dialogue with strongmen like Vladimir Putin and Tayyip Erdogan through crises in Germany's relationship with Russia and Turkey.

But Merkel's statement on Wednesday, in the aftermath of Trump's election, was telling. In it, she set conditions for cooperation with Trump, a provocative message from a close ally to the democratically elected leader of the United States.

"Germany and America are connected by values of democracy, freedom and respect for the law and the dignity of man, independent of origin, skin color, religion, gender, sexual orientation or political views," she said. "I offer the next President of the United States close cooperation on the basis of these values."

Merkel's cabinet colleagues have been far more outspoken. Foreign Minister Frank-Walter Steinmeier has denounced Trump as a "preacher of hate". Vice Chancellor Sigmar Gabriel has called him the pioneer of an international "authoritarian and chauvinist" movement.

The German press has not pulled punches either. The cover of Der Spiegel magazine this weekend showed the head of a grimacing Trump hurtling toward earth like a giant flaming asteroid, above the title "The End of the World (as we know it)".

One of Merkel's biggest foreign policy successes as chancellor was rallying the European Union's disparate 28 member states behind sanctions against Russia in response to its intervention in eastern Ukraine.

If Trump follows through on his promise to forge a closer relationship with Putin, the transatlantic and European front against Russia would crumble, leaving her Putin policy in tatters.

HIGHEST PRICE

Merkel was also the driving force in Europe behind the ambitious trade deal between the EU and United States, known as TTIP (the Transatlantic Trade and Investment Partnership).

That agreement, still in the negotiation phase, seems sure to die under Trump, whose protectionist promises, should they become reality, would hit few countries harder than Germany, whose economic strength depends heavily on the openness of the global trading system.

"Nowhere would a move toward renationalization be more dangerous," former German Foreign Minister Joschka Fischer wrote this week. Germany, he predicted, would pay "the highest economic and political price" if the wave of populism led to a further weakening, or even a collapse, of the EU.

Trump's presidency will challenge Germany on a number of other fronts, from climate and fiscal policy to defense spending and financial regulation.

Trump has promised to do what Merkel and her veteran Finance Minister Wolfgang Schaeuble have resisted for years: take advantage of an ultra-low interest rate environment to invest vast amounts of public money in modernizing infrastructure.

It was ironic that in the same week Trump was elected, Germany was finalizing a 2017 budget that is a model of fiscal restraint. How long Schaeuble will be able to stick to his cherished "Schwarze Null", or balanced budget, with Trump demanding that Europe shoulder more responsibility for its own defense, is unclear.

But one thing does seem clear: in Trump, Germany faces its biggest test since the fall of the Berlin Wall.

"To suggest that Germany has suddenly become the new leader of the western world is not only absurd but dangerous - because it raises expectations that simply can't ever be met," a senior German official said.

(Additional reporting by Andreas Rinke; editing by Janet McBride)