For years, Danish Oil and Natural Gas Co. did what many other big oil companies do: pumped hydrocarbons out of the North Sea.

Today, it’s the world’s largest developer of offshore wind energy, and exceeds the market value of oil giants Occidental Petroleum Corp. and Eni SpA.

Renamed Ørsted AS , it’s one of a handful of once-small energy companies that have grown after pivoting from fossil fuels to renewables, including Spain’s Iberdrola SA, Italy’s Enel SpA and America’s NextEra Energy Inc.

As many oil companies now seek to follow suit, Ørsted is a case study on how hard the shift is. It took government intervention, years of subsidies and a wide-open competitive landscape for Ørsted to succeed. Shareholders and board members repeatedly questioned the strategy shift, and the costs ballooned the company’s debt, nearly derailing it.

Today, subsidies are falling, if they exist at all. Competition for new wind and solar projects is fierce. And returns are lower than most big oil developments.

A big reason for Ørsted’s eventual success is that it doubled down on a single industry—offshore wind—where it already had a first-mover advantage. BP PLC and Royal Dutch Shell PLC, two of the big oil companies with the biggest ambitions for going green, are instead investing in a wide array of low-carbon pursuits, from solar and wind to carbon capture. These are technologies they have dabbled in for years, but never pursued with the focus Ørsted applied to offshore wind.

Ørsted said last week it planned to invest $57 billion by 2027 in wind energy.

A big boost that Ørsted and others are now enjoying: a broad government embrace around the world for offshore wind.

President Biden has moved to fast-track the development of wind power in the U.S., especially offshore in federal waters, to increase the zero-emissions power source and also to create jobs. In May, officials approved what would be the country’s largest project yet, 62 turbines off the coast of Martha’s Vineyard generating enough power for 400,000 homes.

The U.S. currently has just two offshore wind farms—off the coasts of Rhode Island and Virginia—with fewer than 10 turbines in operation.

One of those, the Rhode Island project, is operated by Ørsted. Another in the planning stages, which could move more quickly under the administration’s new goals, is a wind farm being co-developed by Ørsted off the coast of New Jersey—even bigger than the Martha’s Vineyard project, generating enough to power 500,000 homes.