Elon Musk, the CEO of Tesla and SpaceX, has quit two of President Trump's business advisory councils after the president announced he will pull the U.S. out of the historic Paris climate agreement.

"Am departing presidential councils. Climate change is real. Leaving Paris is not good for America or the world," Musk said Thursday on Twitter, shortly after the president announced from the Rose Garden that he would begin the process of leaving the accord.

Musk had vowed to step down from the advisory councils he sits on if the president pulled out of the pact.

Related: Elon Musk says he's 'doing good' on Trump's advisory council

"I've done all I can to advise directly to POTUS, through others in WH & via councils, that we remain," he said Wednesday on Twitter.

Musk was one of 18 business leaders serving on Trump's chief business advisory council, known as the Strategic and Policy Forum. He was also an adviser on the president's manufacturing jobs initiative, and has met with Trump to talk about infrastructure spending.

Disney CEO Bob Iger also announced Thursday that he's resigning from the Strategic and Policy Forum -- bumping the number of high-profile CEO departures up to two.

"As a matter of principle, I've resigned from the President's Council over the #ParisAgreement withdrawal," Iger said on Twitter.

Related: Bob Iger quits Trump advisory team as 'matter of principle'

Musk, in particular, has been under fire from the start for his willingness to engage with the Trump administration.

In April, a startup investor shelled out $400,000 to run ads in the New York Times and the Washington Post urging Musk to "dump Trump." It was part of a $1 million bid to persuade the billionaire CEO that he shouldn't work with Trump, given their sharp ideological differences, especially on climate change.

Until now, Musk had said he thought it was prudent to put his differences with Trump aside so he could have a seat at the table. This isn't the first time Musk has publicly opposed the Trump administration.

Musk adamantly disagreed with Trump's decision to sign an executive order in January that temporarily banned travel from seven Muslim-majority nations.

Despite his concerns, Musk decided to remain on the president's business councils -- even as Uber CEO Travis Kalanick departed amid public pressure.

"Advisory councils simply provide advice, and attending does not mean that I agree with actions by the Administration," Musk said in a statement, posted on Twitter at the time.

Musk's decision to leave is a bold move from a man who has a lot of skin in the game.

SpaceX has scored a number of lucrative government contracts in recent years. The company is currently fulfilling a $1.6 billion contract with NASA to send supplies to the International Space Station. It also has an $82.7 million contract to send a U.S. Air Force satellite into space in 2018. Last month, it launched a spy satellite for a U.S. intelligence agency.

In fact, SpaceX has an ISS resupply mission scheduled for later this week.

But transitioning the world sustainable energy is the crux of Tesla's business -- and Musk's personal brand.

When Tesla (TSLA) starting accepting deposits for its Solar Roof in May, Musk reiterated his belief that the world is moving toward that widespread use of green power.

"That's the vision for the future we think is the only sensible vision for the future -- and the one we're building toward," he said.