Democratic presidential hopeful Beto O’Rourke has reversed positions on a controversial vote he cast on offshore drilling in 2016.

The vote, called “anti-environment” by the League of Conservation Voters, left the door open to using federal money to study oil and gas exploration in the eastern Gulf of Mexico, where offshore drilling is mostly off limits. The current ban has bipartisan support in the battleground state of Florida, and prominent members of both parties oppose drilling in the Atlantic Ocean off the coast of states like South Carolina, which holds a crucial early presidential primary next year.

The O’Rourke campaign told The Texas Tribune Friday that the newly minted 2020 hopeful had a change of heart about his 2016 vote after traveling the country and talking to voters. Beto for America spokesman Chris Evans said O’Rourke’s vote — opposing Democratic attempts to cut off money to investigate drilling in the eastern Gulf — was all about trying to “get off of our foreign reliance on resources in oil and gas that has caused so much foreign wars and American lives and troops and resources.”

“For him it’s looking for ways to harness American ingenuity and resources and doing it with our environmental standards rather than relying on nations who have no environmental standards, so that was the explanation at the time,” Evans said. “But then you know the follow up to that is he wouldn’t cast that same vote today with all that he knows and all that he has heard from people.”

O’Rourke, who represented El Paso in Congress for six years, voted with the majority of Republicans to defeat the anti-drilling amendment from then-U.S. Rep. Gwen Graham, D-Florida. The amendment would have prohibited “the use of funds being used to research, investigate, or study offshore drilling in the Eastern Gulf of Mexico Planning Area.”

The conservative Heritage Foundation issued an alert urging a “no” vote, saying the amendment “would block any potential progress that could take place by preventing the necessary work that would need to be prepared in the East Gulf for potential lease sales and eventual production.”

The amendment failed on a mostly partisan 185-243 vote; 22 Republicans, many representing the impacted area, voted for the coastal protection amendment. O’Rourke was one of 22 Democrats, nine from oil-rich Texas, who voted successfully to kill it. If he had a do-over today, though, O’Rourke — who calls climate change an "existential threat" — would not oppose the measure, said Evans, the campaign spokesman. He also pointed out that O'Rourke has a 95 percent lifetime score from the League of Conservation Voters.

O’Rourke gave Sen. Ted Cruz, R-Texas, the scare of his career in 2018, making him the toast of Democrats and liberals in his home state and beyond. Once he began wandering into a crowded 2020 presidential primary, his Texas-influenced voting record started coming under scrutiny.

During a recent swing through South Carolina, currently scheduled to hold the fourth contest for Democratic presidential candidates in late February next year, O’Rourke spoke against drilling off the coast there.

Democratic presidential candidates who campaign in South Carolina know voters "care very deeply about the issue," said Alan Hancock, energy and climate advocacy director at the Coastal Conservation League, an environmental group based in Charleston.

"They understand if you’re coming to South Carolina, you need to talk about offshore drilling and how you’re going to oppose it,’’ Hancock said.