Barack Obama makes a valedictory visit to Germany Sunday to see his “friend” Angela Merkel, but their show of unity looked unlikely to curb opposition to their plans for a transatlantic trade pact.

Obama will jet into the northern city of Hanover for a final bilateral visit to Europe’s biggest economy.

One of the headline goals of the trip is to advance negotiations on what could become the world’s biggest free trade agreement, the Trans-Atlantic Trade and Investment Partnership (TTIP).

Both sides say they aim to see it finalised, at least in its broad outline, before Obama leaves office in January.

However Merkel’s economy minister Sigmar Gabriel cast doubt on those ambitions Sunday, warning the deal “will fail” if the US refuses to make concessions in the protracted talks.

“The Americans want to hold fast to their ‘Buy American’ idea. We can’t accept that. They don’t want to open their public tenders to European companies. For me, that goes against free trade,” Gabriel, a Social Democrat who is also Germany’s deputy chancellor, told business newspaper Handelsblatt.

His comments came a day after tens of thousands of people marched against the US-EU free trade deal through the streets of Hanover, where Obama and Merkel are to open what is billed as the world’s largest industrial technology fair Sunday night.

During Obama’s seven years in office, the Democrat US president and the conservative German chancellor have grown closer and Obama sees her, among European leaders at least, as first among equals.

Both have an approach to politics that is heavily analytical, leading aides to talk about a relationship that is cerebral and without comparison.

“I consider Angela one of my closest partners and also a friend,” Obama told the Bild newspaper, laying on the compliments on the eve of his trip.

“I’ve worked with her longer and closer than any other world leader, and over the years I’ve learned from her,” he said.

“She embodies many of the leadership qualities I admire most. She’s guided by both interests and values.”

Today, while the United States has a “special relationship” with Britain and France is America’s “oldest ally”, Germany has become Washington’s “indispensable partner”.

He will touch down at 12:40 pm (1040 GMT), arriving in from London for a two-day visit that kicks off with talks with Merkel and a joint press conference.

It will wrap up Monday with a keynote speech, in which Obama is expected to frame his vision of transatlantic relations, and a meeting with Merkel and the leaders of France, Germany and Britain.

For Obama, the trip will be an opportunity to burnish his legacy and bolster Merkel, whose fortunes at home have been hit by her handling of the migration crisis.

Critics say her openness to refugees only accelerated the vast flow of people coming from Syria and beyond.

“I believe that Chancellor Merkel’s approach to the refugee crisis — and that of many Germans — has been courageous,” Obama said, voicing an opinion heard less often in Germany than Merkel would like.

– Rocky road –

Despite the diplomatic niceties, the relationship between Obama and Merkel has also been rocky.

They have frequently clashed, most notably over fiscal policy.

Merkel has backed austerity as the remedy to European sovereign debt crises, while Obama came down firmly in favour of short-term spending to buy time and a way out of the morass.

Officials admit US-German relations hit a low when it became known that the US government had been tapping Merkel’s phone.

That has helped make the German public among the most sceptical of Obama’s leadership in Europe.

According to the Pew Research Center, 45 percent of Germans have an unfavourable view of the United States.

But officials point to the Ukraine crisis and the downing of flight MH17 as a turning point that helped both leaders begin to work in tandem.

Merkel, according to Obama, “has been essential to maintaining European unity against Russia’s aggression against Ukraine.”

Yet Germany’s strength as partner in Europe still has its limits.

“Germany is not of any military use to the United States: it pays too little into NATO and does too little militarily,” said Josef Braml, an analyst at the German Council on Foreign Relations.

“Where they take us seriously is as a European leadership power, and an economic power. And in that sense, we are not just a partner but a competitor. That’s why they spied on us.”