Tesla and SpaceX CEO Elon Musk is stepping away from his roles on two of Donald Trump’s advisory councils following the president’s decision to pull the United States out of the Paris climate agreement. Musk announced the news in a Twitter post shortly after the president’s statement at the White House.

“[I] Am departing presidential councils. Climate change is real. Leaving Paris is not good for America or the world,” Musk wrote. He had previously been a member of Trump’s Manufacturing Jobs Initiative and the Strategic and Policy Forum.

As early as last week Musk had stated that he was “cautiously optimistic of a positive decision.” But yesterday, as rumors swirled that Trump would begin the process of withdrawing the US from the agreement, Musk threatened to sever his connection to the president. “[I] don't know which way Paris will go, but I've done all I can to advise directly to POTUS, through others in WH & via councils, that we remain,” he tweeted.

This prompted another Twitter user to ask him what he’d do if Trump pulled the US out of the accord. Musk responded that he’d “have no choice but to depart councils in that case.”

Am departing presidential councils. Climate change is real. Leaving Paris is not good for America or the world. — Elon Musk (@elonmusk) June 1, 2017

Musk had spent months swatting criticism for keeping his connection with Trump, especially because his companies — Tesla and SpaceX — benefit from government tax credits and contracts. He first explained the decision in February at the height of the controversy surrounding Trump’s proposed travel ban.

“My goals are to accelerate the world's transition to sustainable energy and to help make humanity a multi-planet civilization, a consequence of which will be the creation of hundreds of thousands of jobs and a more inspiring future for all,” he wrote at the time. Musk then claimed that maintaining a relationship with the president would allow him to engage Trump on issues like climate change, which would “on balance serve the greater good.”

Later that week, he wrote that he had used one of the council meetings to raise climate change as an important issue. “I believe this is doing good, so will remain on council & keep at it. Doing otherwise would be wrong,” he added.