It is no secret that the stock market has been rocky since the start of the year. Tech giants such as Apple, Microsoft, Google and Amazon have been no help at all. Their shares have all had double-digit percentage declines.

Dismal as the stock market may be, the situation looks even worse if you are worried about the future of the planet. The fact is that only one broad stock sector has provided consistent returns over the last year: old-fashioned fossil fuel, and the companies that extract, refine, sell and service it.

In fact, when I looked at a performance table of the top companies in the S&P 500 for 2022, I found that 19 of the top 20 spots belonged to companies connected, in one way or another, with fossil fuel. The best performer was Occidental Petroleum, with a gain of 142%.

This isn't just a U.S. phenomenon. Saudi Aramco, the national oil company of Saudi Arabia, is vying with Apple for the distinction of being the world's most valuable publicly traded company. For much of the last year, the rising price of oil has outpaced the value of businesses based on silicon chips.

If you are paying attention to science, this is awkward in the extreme. Yet for short-term investors, energy is looking better than ever.

Russia's assault on Ukraine and the mounting Western sanctions are improving prospects for fossil fuel, Bank of America noted in a report to clients on June 2.

"Our commodity strategists expect that a sharp contraction in Russian oil exports could trigger a full-blown 1980s-style oil crisis," with energy prices rising much higher, the report said. "Not owning energy is becoming more costly," it said.

This poses a classic dilemma for investors who want to follow the guidance of much academic research and be fully diversified. I try to do this by putting my money into low-cost index funds that track the entire stock and bond markets. These funds are marvelous in many ways. They reduce the risks of specific stock selection — owning the wrong stock at the wrong time — and of emphasizing the wrong sectors at inopportune moments.

There is an important catch, though. Complete diversification means owning all sectors and companies, and, in the current environment, that definitely includes traditional fossil fuel companies.

What should you do if you accept the findings of science and, furthermore, want to follow the dictates of your conscience?

One thing you can do is exclude fossil-fuel shares from your portfolio. It is increasingly easy to accomplish, even in 401(k)s and other retirement plans, assuming your workplace plan has a "sustainable" or "socially responsible" investing option.

But in excluding fossil fuels from your investments, you will be missing the market's best-performing part.

One simple way of seeing this cost is by comparing two S&P 500 index funds — the SPDR S&P 500 ETF Trust, a plain vanilla fund that tracks the S&P 500, and the SPDR S&P 500 Fossil Fuel Reserves Free ETF. The second fund excludes the high-performing but climate-warming fossil-fuel companies.

The difference shows up in their returns this year. The plain vanilla S&P fund fell 13.5%, while the fossil-fuel-free fund fell 15.1%. Ouch!

These performance discrepancies aren't the end of the world, you might say, while untrammeled use of fossil fuels may well be. Still, there is undeniably a cost if you avoid fossil fuels.

Yet aside from the benefits of diversification, there is an argument for owning the entire market even if you are troubled by investments in fossil-fuel companies. It is that through stock ownership, you can try to use your voice to ensure that the companies in which you invest behave in ways you can accept.

That is easier said than done. As I've pointed out, the vast majority of shareholders — those with a stake through mutual funds, exchange-traded funds or their pension plan — can't vote directly in the policy and boardroom fights that take place every year in corporate America. Fund managers vote on their behalf, and, until recently, those managers didn't bother to ask what shareholders preferred.

That has begun to change in an experiment involving Engine No. 1, the activist hedge fund that took on Exxon Mobil and won a wildly successful proxy battle last year.

Now, with the help of Betterment, an asset management platform, and Tumelo, a British financial technology company, Engine No. 1 has been asking investors in its S&P 500 index fund, with the provocative ticker VOTE, how they would like their votes to be cast.

This is still light-years away from the direct voting by mutual fund investors that I think is needed. Still, of such fledgling steps is progress made: asking shareholders what they want, and respecting their preferences.