HANOVER, Germany (Reuters) - U.S. President Barack Obama said on Sunday he would do whatever he could to advance a controversial trade deal with the European Union in his last eight months in office, but warned that time was running short.

Obama has pushed to complete two trade agreements before his term ends on Jan. 20 - with Pacific nations and with the EU - but has run into a growing swell of populist concerns about the impact on jobs, consumer protections and the environment.

“Time is not on our side,” he conceded to business leaders at the Hanover Messe, a massive industrial trade fair.

“If we don’t complete negotiations this year, then upcoming political transitions in the United States and Europe would mean this agreement won’t be finished for quite some time.”

Obama is in Germany to promote the Transatlantic Trade and Investment Partnership (TTIP) with German Chancellor Angela Merkel, but the issue was overshadowed by discussions on the crises in Syria, Ukraine and Libya when the two leaders met.

On Monday, they are set to hold talks with British Prime Minister David Cameron, French President Francois Hollande and Italian Prime Minister Matteo Renzi on some of the same issues.

But first, they had dinner in a 17th century palace with chief executives of some of the largest U.S. and German companies such as Microsoft, Dow, Lockheed Martin, Honeywell, BASF, Bayer and Siemens.

Also at the dinner was Matthias Müller, CEO of Volkswagen, whose company has admitted to cheating diesel emissions tests in the United States, a scandal that involves 11 million vehicles worldwide.

POLITICAL CAPITAL

Obama normally does not sit through lengthy opening ceremonies.

But in a sign of the political capital he is spending on trade - and his affection for Merkel - he took a front row seat for an unusual interpretative dance performance featuring robots, futuristic music and acrobatic break-dancing.

The day before Obama arrived, thousands of protesters holding placards with slogans like “Stop TTIP” marched to express their opposition to the deal, and his motorcade whizzed past a few more as he drove through the north German city.

Obama acknowledged his message about the benefits of trade has not broken though.

“The benefits oftentimes are diffuse, whereas a particular plant or business that feels it’s been hurt by outside competition feels it very acutely,” he told reporters.

Obama said he hoped the deal, which supporters say could boost economies on each side of the Atlantic by $100 billion, would be agreed this year.

But final ratification will take more time. The Trans Pacific Partnership is first in the queue for the U.S. Congress, which is not clamoring to hold a final vote.

Obama said that could change after the Democratic and Republican parties make their final selections of candidates this summer.

Slideshow ( 23 images )

“When we’re in the heat of campaigns, people naturally are going to worry more about what’s lost than what’s gained with respect to trade agreements,” he said.

‘RIGHT SIDE OF HISTORY’

Germany is the last stop on a six-day foreign tour where Obama has sought to shore up U.S. alliances he views as important not only for the economy but also to defeat Islamic State militants and counter Russian intervention in Syria and Ukraine.

“Strong growth in Europe is particularly important given the array of pressing challenges - whether it’s security, defense, migration or refugees,” Obama said.

Slideshow ( 23 images )

Obama came to Germany from London where he urged Britons to vote to stay in the European Union in a closely-watched June referendum or face being at “the back of the queue” as a non-EU member hoping for a new trade deal with the U.S.

Earlier in the week, he met with Gulf leaders in Riyadh to try to allay fears that Washington had become less committed to their security, especially after the nuclear deal with Iran, the regional rival of Saudi Arabia.

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

Merkel urged the parties participating in troubled peace talks in Geneva to agree to humanitarian zones where fleeing Syrians could feel safe from bombardment. She and Obama made clear that they did not favor the creation of classic “safe zones” which would need to be protected by foreign forces.

Both leaders expressed concerns about ceasefire violations in eastern Ukraine and said sanctions imposed against Russia following its 2014 intervention there, could not be eased if the situation on the ground did not improve.

Ties between Washington and Berlin reached a low point three years ago following revelations of widespread surveillance of German citizens, including the bugging of Merkel’s mobile phone, by the U.S. National Security Agency.

But in recent years, the two Cold War allies have patched things up.

Obama praised Merkel for her “steady leadership” and handling of Europe’s refugee crisis, saying her decision last year to welcome hundreds of thousands of migrants to Germany had put her “on the right side of history”.

He joked that Merkel, who lacks his easy-going charm, had a “really good sense of humor” even if it wasn’t always on public display, drawing chuckles from the 61-year-old chancellor.

Merkel refused to be drawn when asked whether she was concerned that she might soon have to work with Donald Trump, the leading Republican candidate for president, who has labeled her refugee policies “insane”. She said only that she was watching the American election campaign “with interest”.