Not long ago, global environmental activists looked at India with worry.
The world's fastest growing major economy — and one of its fastest growing emitters of carbon — was building coal-fired power plants at a rapid clip while its leaders argued that burning the carbon-spewing fossil fuel was necessary for the country's development.
Yet over the last two years, India has suspended several major coal projects and announced plans to triple its renewable energy capacity by 2022.
India is shedding its reputation as an outlier in the fight against climate change at the same time as President Trump has pledged more money for the U.S. coal industry and threatened to withdraw from the 2015 Paris agreement, which requires signatories including India to take steps to cut the greenhouse gas emissions driving the global rise in temperatures.
"Trump is investing in our grandfather's technology while India is looking ahead to the future," said Anjali Jaiswal, head of the India initiative at the National Resources Defense Council. "It's a starkly different approach."
If Trump does renege on the Paris accord, it would leave a particularly bitter taste for India.
When Barack Obama was president, he made fighting climate change a centerpiece of several bilateral meetings with Indian Prime Minister Narendra Modi. The pro-business Indian leader took office in 2014 promising to boost manufacturing and bring electricity to far-flung villages, presumably by investing even more heavily in coal, which provides more than 60% of India's electricity.
But as Modi sought closer ties with the U.S., he became an unlikely proponent of green energy policies. India was one of the last major countries to join the Paris process but adopted ambitious targets. It pledged to slash emissions intensity — the amount of carbon dioxide it emits for every dollar its economy produces — by at least 33% and ensure that by 2030 at least 40% of its domestically produced electricity comes from solar, wind and other renewable sources.
India's emissions are expected to triple between 2005 and 2030, but the increase would be much greater if the country did not fulfill those pledges, officials said.
While Indian officials have not publicly commented on Trump's campaign promise to "cancel" the Paris accord, experts say there is frustration that the U.S. is undermining an agreement that developing countries believe was written largely to satisfy Western interests.
Many compared it to President George W. Bush's rejection of the Kyoto Protocol, an international agreement to cut greenhouse gas emissions that his predecessor Bill Clinton had signed.
"I think there will be those who feel like the U.S. has just done this once too often — laying the rules for the game and then picking up their ball and walking away," said Navroz K. Dubash, coordinator of the Initiative on Climate, Energy and Environment at the Center for Policy Research, a New Delhi think tank.
Still, Dubash said, India is likely to stick to its Paris commitments, in part because salvaging the environment has become an important domestic issue.
India, home to more than 1.25 billion people, is responsible for 6% of global carbon emissions, the third-highest percentage in the world but far behind the United States and China. Since Modi took office, air pollution has prompted a public health crisis in New Delhi and prolonged drought has been blamed for hundreds of farmer suicides in western India.
Scientists have described India, with its 4,700 miles of coastline and 1,300 islands, as one of the countries most vulnerable to rising sea levels.
"India had to make ambitious climate targets not just because of global pressure but to protect its own people," said Vijeta Rattani, a climate change analyst at the Center for Science and Environment, a New Delhi think tank.
Mirroring a trend across Asia, Modi's government is backing away from coal.
Of 16 "ultra-mega power projects" once proposed in India — coal-fueled plants with a capacity of 4,000 megawatts or more — only two have been built, and even those are hindered by public opposition and financial pressures. India's weak electricity companies have been unable to distribute much of the new power being generated, and officials said last December that they wouldn't need to build any new coal-fueled plants for another decade.
At the same time, the cost of solar power is rapidly falling, making it almost as affordable as cheap coal-based energy. Modi is aiming to attract $100 billion in solar investment by 2022.
Yet experts say it is far from certain that India will meet its targets.
Like many developing nations, India is relying on richer nations to help finance its investments in renewable energy. But Trump has threatened to cancel $2 billion in pledges the Obama administration made to the Green Climate Fund, which aims to help poor countries deal with climate change.
"If the U.S. cuts its pledges, or does not contribute to international funding, that may have an impact on the implementation of the climate plans of developing countries," Rattani said.
And demand for coal is likely to rise again as Modi presses ahead with plans to expand industries into rural areas and a growing urban middle class buys more air-conditioners and other electricity-intensive appliances.
"Even by mid-century it is projected that the major share of power generation will be from coal-based sources," said Prodipto Ghosh, a former Indian climate negotiator.
But Ghosh said India would not follow suit if the U.S. junked the Paris accord.
"India would seek to retain its reputation for adhering scrupulously to international agreements it has acceded to," he said.
Follow @SBengali on Twitter for more news from South Asia