Two decades ago, John Browne rocked the oil industry by saying that the “possibility cannot be discounted” of a link between man-made carbon emissions and global warming, and that it was time for “action.” In 1997, Mr. Browne, then chief executive of BP, the London-based oil company, was a lonely voice among his peers.

How much has changed since his speech? Most large oil companies no longer deny the connection between burning fossil fuels and climate change. In fact, they are scrambling to position themselves to be seen as part of the solution to what is increasingly seen by worried citizens as a major threat.

Royal Dutch Shell , the European oil company, France’s Total and others are putting substantial funds into clean-energy investments. Several companies have formed the Oil and Gas Climate Initiative to invest in low-carbon technologies and reduce the powerful greenhouse gas, methane.

The companies are trying to deal with what is shaping up as a major threat to their businesses: societal demands, especially in Europe, for a sharp curtailment of the consumption of the oil and gas that are the lifeblood of these organizations. “Climate change poses an existential risk to the oil and gas industry,” wrote Neil Beveridge, an analyst at Bernstein, a Wall Street research firm , in a recent note to clients.