It's been a great year for solar energy investors. The Invesco Solar ETF (NYSEMKT:TAN), which owns a stake in more than 20 companies focused primarily on some area of solar, is up 55% so far this year. Two stocks held in the Invesco Solar ETF that are responsible for a lot of those gains are Enphase Energy (NASDAQ:ENPH) and SunPower (NASDAQ:SPWR), up 358% and 102% respectively.

First Solar (NASDAQ:FSLR), another component of the Invesco Solar ETF, has also had a strong year. At this writing shares are up 32%; that may not match the performance of some of its solar peers, but it's almost 70% better than the 19% in total returns the S&P 500 has generated so far in 2019.

But more recently, Enphase, SunPower, and First Solar have fallen sharply. Those stellar returns to date would be even better if not for a recent swoon across the solar sector that's seen the three lose 38%, 33%, and 17% from their 2019 highs. I think that's made for an excellent opportunity to buy, for anyone who's willing and able to hold them.

Company Primary Business Stock Return (Year to Date) Change From High Enphase Energy Power management and energy storage systems 369% (36%) SunPower Solar-panel manufacturing 107% (32%) First Solar Solar-panel manufacturing 33% (16%)

There's a multiyear opportunity ahead of the solar industry, and all three of these companies are positioned to profit. Three key reasons underpin my thesis that these are "buy on the dip" stocks worth owning for the long term:

A growing global middle class will require substantial expansion in energy production. Solar costs continue to fall while efficiencies get better. Energy storage technology is quickly expanding the percentage of the world's energy needs that solar can meet.

Here's how these three things are set to make SunPower, First Solar, and Enphase Energy moneymaking stocks worth buying now and owning for years to come.

This huge trend will drive substantial growth in solar power

In the U.S., the middle class hasn't had a very good run in recent decades. Inflation has outpaced middle-class wages for years, and income and wealth inequity have see the rich get richer and the rest of us fight over what's left.

However, in many of the world's up-and-coming markets, the middle class is booming. According to a 2017 Brookings report, the middle class is expected to make up more than half the world's population by 2020, and then grow by another one billion people by 2028.

That population growth, which will be primarily in urban centers, will require substantially more clean energy. Many of the cities expecting the biggest population growth already deal with some of the worst air quality. And solar power is on track to play a major role both in fueling increased electricity needs, and in replacing coal and other fossil-fuel generation sources.

Solar keeps getting cheaper and better, and can address energy security

While government programs play a role in making solar panels cost-competitive, innovation has been the biggest driver behind making solar panels more cost-effective than fossil fuels. According to Lazard, solar manufacturing costs per megawatt fell an incredible 86% between 2009 and 2017. This massive improvement in costs is a product of two things: increased manufacturing scale, and efficiency gains.

SunPower and First Solar are two of the leaders in this regard. SunPower has been a leader in panel efficiency for years, and that's made it a top brand for rooftop solar, where its high-efficiency panels help homeowners and businesses maximize available space to generate electricity. More recently, SunPower has expanded its business beyond premium high-efficiency panels, acquiring a U.S.-based manufacturer of lower-cost commodity panels targeted at the utility-scale market, where cost per watt is a bigger factor for buyers.

Speaking of utility-scale, First Solar continues to be a leader. Its thin-film technology is the standard-setter in energy generation and reliability for utility projects. Its Series 6 panels (introduced last year) have raised the bar yet again, with efficiency of up to 18%, and a more reliable output profile in high and low temperatures than its competitors.

Moreover, it's likely that solar panels from First Solar and SunPower will continue to get more efficient and cheaper to make. Prices are already quickly approaching parity with all but the newest natural-gas power plants. Part of the cost equation is the power-management accessories Enphase makes. Over the past decade, Enphase has established itself as a leader and key partner for solar-panel makers, providing the accessories that convert the DC (direct current) electricity that solar panels make into the AC (alternating current) power that the grid transmits. Enphase's microinverters are able to manage power at each solar panel, maximizing their output while also increasing system safety, all while (as with panels) the costs for inverters continue to fall.

Given another decade, it's likely that solar will be a cheaper source of electricity than any fossil fuel. Moreover, as the recent attacks on major oil sites in Saudi Arabia remind us, energy security could play a big role in reducing our reliance on a commodity -- oil -- that's located in some of the least politically stable places on earth.

Energy storage tech is making solar even more competitive

The counterargument to the growth prospects for solar is legitimate: Solar can't generate power all the time, a problem that also limits the applications for wind turbines. For this reason, it's likely that natural gas will remain an important source of "baseload" electricity generation around the world for years to come. Moreover, the newest generation of natural-gas power plants are more efficient and generate lower emissions than prior technologies, giving them a leg up over the coal plants they often replace.

But energy storage technology is quickly making inroads in residential, commercial, and industrial markets, and closing the gap for utility-scale solar to meet more applications. Many users of "distributed solar" -- on-site solar at homes or businesses -- generate more electricity than they consume during daylight, banking the value of that energy (either as a dollar value or an energy value) with their utility in exchange for power from the grid at night.

The problem for grid operators is that this often results in a mismatch of power during the peak period at the end of the day, when total grid demand spikes right as solar production falls. The end result is that solar can actually make it harder for utilities to meet peak demand, since solar production falls off right when grid demand is highest. Energy storage can help bridge the gap for both consumers and utilities.

Falling battery prices -- along with improved chemistry and materials science that improve lifespan and reliability -- are allowing homes, businesses, and even utilities to more fully utilize their solar systems even when the sun isn't shining. For SunPower and Enphase, both of which sell energy storage systems, the growth in this market over the next decade could drive enormous returns.

For First Solar, it's a longer play. Over the long term, it should lead to more utility-scale projects that, when connected to energy storage, can play a role in meeting baseload applications. Today, solar paired with energy storage is moving towards being cost-competitive with "peaker" plants, smaller gas-fired plants that can be brought online quickly to add additional capacity to the grid during peak times.

How big is the opportunity? In 2018, 311 megawatts' worth of battery storage was installed in the U.S., or enough to power 75,000 homes for an entire year. The solar-industry analyst company Wood Mackenzie expects annual installations to reach -- and surpass -- 4,500 MW in capacity within five years. That's massive growth.

Act opportunistically, but think long-term

As 2019 has already shown, solar stocks can be volatile. If you were fortunate to have bought early this year, any of Enphase, SunPower, or First Solar will have rewarded you with big gains. But if you invested just about anytime during the past month, you've probably lost money so far.

The reality is that we might see share prices continue to fall in the short term -- particularly for Enphase, which has seen its stock price surge so much this year. But if you have the stomach to ride out short-term declines, and long-term financial goals that enable you to invest for multiple years, I expect that all three will reward you with solid returns. There are a lot of things in solar's favor, and Enphase, SunPower, and First Solar should be key parts of a solar-powered future.