Tesla chief executive Elon Musk threatened on Wednesday to resign his position as an adviser to President Donald Trump if the United States withdraws from the Paris climate deal, a remark that highlights Trump's precarious position in a high-stakes international standoff.

Trump could decide as early as this week whether the United States will remain in the historic Paris Agreement, which reflects a voluntary commitment by the world's governments to reduce their carbon emissions.

Musk said on Twitter that he had done all he could to advise the White House on the deal that was signed in 2016 by 195 countries.

Asked by another Twitter user what would happen if Trump withdraws in spite of Musk's advice, the entrepreneur said he would have "no choice" in the matter.