Anti-fracking protesters demonstrate outside the Waldorf Astoria hotel in New York City as New York Gov. Andrew Cuomo attends a function there, Jan. 7, 2013. Spencer Platt/Getty Images

The Democratic presidential candidates this month are battling over their green credentials in two delegate-rich states that have starkly different policies on hydraulic fracturing: New York, where the practice is banned, and Pennsylvania, where a fracking boom is fueling the local economy.

Sen. Bernie Sanders this week called for a nationwide ban on the oil and gas extraction technique during a campaign stop in Binghamton, New York. “If we are serious about combating climate change, we need to put an end to fracking ... all over this country,” he told supporters.

The Vermont senator has criticized Hillary Clinton for her record on environmental issues and accused the former secretary of state of being too cozy with oil and gas companies. Clinton, for her part, has rebuffed Sanders’ accusations of Big Oil influence. During a stump speech outside Albany last week, she pledged to transform America into a “clean energy superpower” and carry out the global climate accord reached in Paris last year.

The candidates will face each other Thursday in the CNN/NY1 Democratic debate in Brooklyn ahead of the April 19 New York primaries. They square off again in Pennsylvania on April 26 in another significant late primary for the Democratic race.

Clinton, a former two-term senator for New York, was ahead of Sanders in New York by 14 points — 55 percent to 41 percent — among likely Democratic primary voters, according to an NBC News/Wall Street Journal/Marist poll published Monday. But Sanders’ anti-fracking message continues to resonate with those New Yorkers who are worried about an influx of natural gas infrastructure cropping up across the Empire State.

The fracking process involves blasting millions of gallons of water, sand and chemicals into shale formations to crack open rocks and free up the crude oil and natural gas reserves. Fracking is controversial because it raises concerns of groundwater contamination and air pollution near the oil and gas wells. The process also produces copious volumes of wastewater, which are stored underground and have been linked to earthquakes in Oklahoma, Ohio and other shale-rich states and have contaminated rivers in Pennsylvania and West Virginia.

Yet fracking has also enabled explosive growth in the U.S. energy sector. Crude oil production has roughly doubled since 2008, while natural gas production is up nearly 40 percent over the same period, the U.S. Energy Information Administration estimated. Shale production has generated billions of dollars in revenue for energy-rich states and created thousands of jobs.

With the competing narratives of economic growth and environmental hazards, fracking remains a divisive issue in local communities and national politics.

In New York, Democratic Gov. Andrew Cuomo banned the practice of fracking in December 2014, citing health risks. But the state still faces a flurry of proposals to pipe in, process and consume shale gas produced in nearby states like Pennsylvania and Ohio. Opposition to gas infrastructure projects in New York has helped rally environmentalists and anti-fossil fuel activists this election season.

“The movement to ban fracking in New York hasn’t gone away since the governor’s decision. If anything, it’s grown,” said Seth Gladstone, a Brooklyn-based spokesman for Food and Water Watch, an environmental group that helped spearhead the campaign to ban New York fracking. “We’re continuing to see the grassroots groups mobilizing around these infrastructure fights throughout the state.”

Clinton hasn’t denounced fracking outright. Instead, she’s called for a series of tougher regulations, such as requiring energy companies to disclose the chemicals they use, or prove they aren’t polluting nearby water or land. “By the time we get through all of my conditions, I do not think there will be many places in America where fracking will continue,” Clinton said in the March 6 Democratic debate.

Since the start of her campaign, Clinton has moved noticeably to the left on climate change issues, including opposing the Keystone XL pipeline — which she was once “inclined” to support — and offshore oil and gas drilling. The progressive drift is in part a response to Sanders’ hard line against fossil fuels and the companies that produce them.

The Sanders campaign in recent weeks has accused Clinton of taking sizable campaign donations from the oil and gas industry in an attempt to discredit her environmental qualifications. The activist group Greenpeace said Clinton took more than $4.5 million from the fossil fuel sector to support her presidential bid — a number that fact-checking site PolitiFact.com reported was highly inflated.

According to the Center for Responsive Politics, the Clinton campaign had received nearly $308,000 from individuals in the oil and gas industry as of March 21. Counting contributions from outside groups, the total rises slightly to $330,000, or roughly 0.2 percent of the $160 million raised by the Clinton campaign so far. The Sanders campaign, by contrast, has received nearly $54,000 from individuals with fossil fuel ties, or about 0.04 percent of the nearly $140 million raised so far by the campaign committee.

Anti-fracking demonstrators protest on 51st Street and Seventh Avenue as President Barack Obama arrives at the Sheraton Hotel in New York, Sept. 23, 2014. bryan thomas/getty images

While Sanders’ staunch fracking opposition could help him in New York, it’s less clear how the message will play out in Pennsylvania, the state at the heart of the U.S. shale gas boom.

Fracking has transformed areas of Pennsylvania once better known for boarded-up steel mills and idling coal plants. Shale gas has been an economic boon for the state, but the relatively rapid pace at which energy companies began snapping up land leases and drilling new wells has given many residents pause. Citizens broadly supported a move by Democratic Gov. Tom Wolf to ban fracking in state parks and forest lands.

“Pennsylvanians have a guarded acceptance of fracking. They’re wary of it, but they’ve kind of accepted it,” said Fletcher McClellan, a political science professor and dean of faculty at Elizabethtown College near Harrisburg in southern Pennsylvania.

Pennsylvania’s energy boom has become a flashpoint in the state legislative race this year, with candidates vowing to impose — or prevent — a severance tax for oil and gas producers. Pennsylvania is the only energy-producing state without such a levy, which can garner millions of dollars each year for state governments that do impose the tax.

John Fetterman, a Democratic candidate for U.S. Senate and a Sanders supporter, has called for instating the severance tax and adopting more-rigorous environmental regulations on the oil and gas industry. He said Sanders’ call to stop fracking nationwide would resonate well with those Pennsylvanians who worry about the effects of years of drilling on the state. “It’s a winning issue for Sanders,” Fetterman said.

A worker walks toward a part of a Consol Energy Horizontal Gas Drilling Rig exploring the Marcellus Shale formation outside the town of Waynesburg, Pennsylvania, on April 13, 2012. MLADEN ANTONOV/AFP/Getty Images

Other political observers said Clinton’s measured approach to fracking might appeal more to Pennsylvania’s Democratic voters, given the outsize role the industry has in state and local economies.

“People look at it as a lifeblood industry, although with caveats. They would want heavy taxes paid by the drillers. And they don’t want it in state parks,” said Tim Malloy, assistant director of the Quinnipiac University Poll.

“Being flat-out against fracking in Pennsylvania may not be a winning strategy,” he added.

Yet Terry Madonna, director of the Franklin & Marshall College Poll in Lancaster, Pennsylvania, said he doesn’t see fracking as much of a factor in Democratic voters’ decisions. When the college conducted a poll in March about the most important issue in their presidential selection, virtually nobody mentioned the oil and gas extraction technique.

He said fracking is a “reinforcing” issue for Pennsylvanians. “Most of the people who are for Sanders are shaking their heads, ‘Right on, brother,’” Madonna said. “Those who are for Clinton aren’t going to change over this issue.”