US President Donald Trump has said he was nearing an announcement on whether to pullout of a global pact to fight climate change and was listening to people on both sides.

However, a source close to the matter said Mr Trump was preparing for a US withdrawal from the Paris climate deal.

A US pullout could deepen a rift with US allies and the United States would join Syria and Nicaragua as the world's only non-participants in the 195-nation accord agreed upon in Paris in 2015.

Responding to shouted questions from reporters in the White House Oval Office, Mr Trump declined to say whether he had made up his mind, saying: "You'll find out very soon. I'm hearing from a lot of people, both ways."

Mr Trump, who has previously called global warming a hoax aimed at weakening US industry, said as he met with Vietnamese Prime Minister Nguyen Xuan Phuc.

The source, speaking on condition of anonymity, said Mr Trump was working out the terms of the planned withdrawal with US Environmental Protection Agency Administrator Scott Pruitt, an oil industry ally and climate change doubter.

White House spokesman Sean Spicer declined during a news briefing to say whether the Republican president might opt for an action short of complete withdrawal.

Under the pact, virtually every nation voluntarily committed to combat climate change with steps aimed at curbing global emissions of "greenhouse" gases.

These include carbon dioxide generated from burning of fossil fuels that scientists blame for a warming planet, sea level rise, droughts and more frequent violent storms. It was the first legally binding global climate deal.

Under the pact, the United States committed to reduce itsemissions by 26% to 28% from 2005 levels by 2025.

In the past few days, the chief executives of dozens of companies have made last-minute appeals to Mr Trump.

The CEOs of ExxonMobil Corp, Apple Inc, Dow Chemical Co, Unilever NV and Tesla Incwere among those urging the US President to remain in the agreement, with Tesla's Elon Musk threatening to quit White House advisory councils of which he is a member if the president pulls out.

Robert Murray, CEO of Murray Energy Corp, an Ohio-based coal company and major Trump campaign do nor, urged Mr Trump to withdraw.

Mr Trump has said the accord would cost the US economy trillions of dollars without tangible benefit. For the Republican president, a withdrawal would reflect his "America First" approach to policy, unencumbered by international obligations.

Mr Trump refused to endorse the landmark climate change accordat a summit of the G7 group of wealthy nations last Saturday in Italy, saying he needed more time to decide.

A pullout also would be one more step by the Republican president to erase the legacy of his predecessor, Democrat Barack Obama, who helped broker the accord and praised it during a trip to Europe this month.

UN Secretary General Antonio Guterres has said it is "absolutely essential" that the Paris accord be implemented.

Mr Guterres made the remarks at New York University.

In his first major address on climate, Mr Guterres said the world must fulfil the commitments of the 2015 agreement "with increased ambition".

Mr Guterres said: "If any government doubts the global will and need for this accord, that is reason for all others to unite even stronger and stay the course."

The Paris agreement's commitment to curb carbon emissions and limit temperature rise to well below 2C and as close as possible to 1.5C "do not nearly go far enough," he said.

He added: "So we must do our utmost to increase ambition and action until we can bend the emissions curve and slow down global warming."

Mr Guterres's appeal suggested that if the United States, the world's biggest carbon emitter after China, were to leave the deal, the onus would be on other key players like China, India and the European Union to do more to fight global warming.

Describing the agreement as a "remarkable moment in the history of humankind," the UN chief stressed that private corporations including oil and gas companies, were not awaiting government policy and were joining the green economy.

"Those who fail to bet on the green economy will be living in a grey future," he warned.

"On the other hand, those who embrace green technologies will set the gold standard for economic leadership in the 21st Century."