Something weird happened at a Trump campaign appearance in Jupiter, Florida, on Tuesday. President Trump — long-time antagonist of environmental regulations and big-time proponent of oil and gas developmentannounced a decade-long ban on offshore drilling off the coasts of Florida, Georgia, and South Carolina. “This protects your beautiful Gulf and your beautiful ocean, and it will for a long time to come,” Trump said in a speech in Jupiter touting his environmental record. He signed a presidential memorandum extending a moratorium on leasing drilling rights off Florida’s Gulf Coast and expanded that ban to a portion of the Atlantic Ocean that stretches between Florida and South Carolina. (The area has not been leased out to oil companies yet.)

The decision caught environmentalists and oil industry lobbyists off guard. “It’s a complete ambush,” one industry official told Politico. “Nobody knows where this came from.”

So, what gives? The president has been consistent in his support of offshore drilling pretty much since his first year in office. He made no secret of his intention to reverse a memorandum signed by President Barack Obama in 2016 to protect the Arctic and Atlantic seas from drilling. In 2017, Trump directed the Department of the Interior, which oversees offshore drilling leases, to assess new sales of drilling rights in the Arctic and Atlantic Oceans. The following year, the Interior Department came out with a draft plan that would have paved the way for offshore drilling leases in 90 percent of U.S. coastal waterways.

That proposal faced pushback from states whose economies rely on tourism and fishing. Florida’s Republican governor at the time, Rick Scott, said he opposed the plan. So did the governors of other states like New Jersey, Washington, and California. The Trump administration let Florida opt out of the plan, handing Scott a win as he prepared to do battle against Democratic incumbent Bill Nelson for a Senate seat that year. (Scott won by a narrow margin.) The other states weren’t granted a reprieve.

Grist thanks its sponsors. Become one.

It doesn’t take a genius to connect the dots between what happened in 2018 in Florida and Trump’s surprise announcement on Tuesday. Trump’s new moratorium on offshore drilling appears to solely apply to states led by Republicans.

What’s more, Florida and Georgia are key swing states in the upcoming general election. Trump and Joe Biden are neck and neck in Florida in recent polls. Whichever candidate wins that state gets its large stack of 29 electoral votes. South Carolina isn’t as tight of a race, but one of its Republican senators, Lindsey Graham, is close with Trump and reportedly helped craft the new moratorium.

Grist thanks its sponsors. Become one.

States with Democratic governors weren’t as lucky. North Carolina and Virginia, which also have significant resources buried off their coasts, weren’t included in Trump’s moratorium. Trump recently accused North Carolina’s governor, Democrat Roy Cooper, of using the coronavirus pandemic to hurt his reelection effort.

Trump’s memorandum could be challenged in court, but there’s reason to believe it will stand the test of time. Despite the Trump administration’s efforts to undo Obama’s 2016 offshore drilling ban in the Arctic, federal courts have upheld Obama’s memorandum so far.

Still, green groups aren’t convinced that Trump is acting in good faith. “If this was more than an election year ploy for Trump, we’d have seen a permanent ban on offshore drilling in his first four years,” the League of Conservation Voters said in a statement. Democratic presidential nominee Joe Biden is also suspicious. “Just months ago, Donald Trump was planning to allow oil and gas drilling off the coast of Florida,” the former vice president said in a tweet. “Now, with 56 days until the election, he conveniently says that he changed his mind. Unbelievable.”