Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

President Donald Trump said Thursday that he would consider re-entering the Trans-Pacific Partnership trade pact if he got a “substantially better” deal.

Trump, who withdrew the U.S. from the agreement by executive order in one of his first acts as president, made the comments about the trade deal to CNBC on the sidelines of the World Economic Forum in Davos, Switzerland.

“I would do TPP if we made a much better deal than we had. We had a horrible deal,” he said. “I would do TPP if we were able to make a substantially better deal. The deal was terrible, the way it was structured was terrible. If we did a substantially better deal, I would be open to TPP.”

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

He also called NAFTA a “horrible” deal, and reiterated that his administration is “renegotiating it.”

"We're trying right now with Bob Lighthizer and the whole group — I think we have a good chance, but we'll see what happens," Trump said, referring to the U.S. trade representative.

Trump made withdrawing the U.S. from trade pacts that he said were harming American workers a key promise of his campaign. He targeted the Trans-Pacific Partnership, a free-trade agreement with 11 other countries, because he claimed it would contribute to manufacturing job losses.

Just days into his presidency, Trump signed an executive order formally withdrawing the U.S. from the partnership, which had been back by President Barack Obama as a way to strengthen economic ties with Asian nations. It was never ratified by Congress.

But the 11 other countries in the partnership have remained committed to the pact, negotiating their own deal and leaving the U.S. out.

Renamed “the Comprehensive Progressive Agreement for the TPP,” the 11 countries — Australia, Brunei, Canada, Chile, Japan, Malaysia, Mexico, New Zealand, Peru, Singapore and Vietnam — reached their deal this week and intend to sign it at a meeting in Chile in March.

Canadian Prime Minister Justin Trudeau used his speech at the World Economic Forum to tout the new pact, calling it “the right deal.”

Trump — the first sitting president to attend the annual Davos gathering of the global economic elite in nearly 20 years — insisted that his visit did not contradict his “America First” message.

“When I decided to come to Davos, I didn’t think in terms of elitist or globalist. I thought in terms of lots people that want to invest lots of money, and they’re all coming back to the United States,” he said. “After I said that I was going, there were massive stories about ‘the elite’ and ‘the globalists’ and the planes flying in and everything else. It’s not about that, it’s about coming to America, investing in money, creating jobs, companies coming in.”