Elon Musk to depart President Trump's business council after the president announced the U.S. withdrawal from the Paris Accord.

Musk had served on councils advising Trump on business, manufacturing jobs and infrastructure. He had defended his decision to serve the president, despite criticism. However, on Wednesday Musk warned he might quit if Trump withdrew from the Paris Agreement.

Leaving the agreement is "not good for America or for the world," the Tesla and Space X CEO said in a tweet.

Elon Musk said Thursday he will leave his positions on three presidential councils.

The landmark climate deal calls for the U.S. to reduce its greenhouse gas emissions by between 26 and 28 percent below 2005 levels by 2025, among other things.

Trump has said the Paris accord was negotiated to have terms that are unrealistic and unfair to the U.S.

The president is looking to withdraw from the accord and immediately restart talks to set targets that would be more fair . However, French, German and Italian officials said they do not believe the agreement can be renegotiated.

The accord was the result of more than 20 years of negotiations, and the only countries in

the United Nations Framework Convention on Climate Change that have not signed on to the deal are Syria and Nicaragua.

Proponents of the deal expect it will help bolster businesses like those that Musk runs. Both electric cars and solar energy can be used to help reach the targets proposed in the deal.

Musk isn't the only CEO who has pushed Trump to uphold the deal. Others include Apple and Microsoft.

Silicon Valley investor Doug Derwin, who had pledged to spend up to $2 million of his own money on a campaign to pressure Musk to quit the councils, welcomed the news.

"Thanks, Elon, for doing the right thing," said Derwin, in a statement sent to CNBC on Thursday. "Welcome to the resistance."

Watch: Macron says Paris climate deal 'irreversible'