President Trump was told at the G7 summit in Sicily that the U.S. can't simply leave the Paris climate change agreement, the president of the European Commission said Wednesday.

"We tried to explain that to Mr. Trump in Taormina in clear German sentences," said Jean-Claude Juncker, head of the European Commission, which is the governing body of the European Union. "It seems our attempt failed, but the law is the law and it must be obeyed."

Juncker is not German, but from Luxembourg, where the German language is primarily used in matters of the law.

Juncker explained that the "Americans can't just leave the climate protection agreement," adding that Trump believes he can exit the deal "because he doesn't get close enough to the dossiers to fully understand them."

The commission president said withdrawing from the Paris Agreement would take Trump down a three- to four-year process of withdrawal. So the direct action Trump is promising is impossible.

"So this notion, 'I am Trump, I am American, America First and I'm going to get out of it' — that won't happen," Juncker said.