The federal government giveth, but the states can taketh away. That’s what Big Solar is finding out in Nevada, where recent regulatory moves have caused several solar installers to fire workers and fold their operations.

In December, the solar industry experienced a Christmas miracle in Washington. Companies like SolarCity had been in the dumps over the prospect of the generous 30 percent federal solar investment tax credit sunsetting at the end of 2015. But Congress’ year-end tax-and-spending deal maintained the tax credit at 30 percent through 2019 (it’ll fall to 10 percent through 2022). Suddenly, the business case for building solar at both the wholesale level (giant solar farms) and the retail level (small systems on rooftops) made sense again. Solar stocks rallied sharply.

The federal move provided certainty for large-scale solar development. You subsidize the big upfront investment with the tax credit and then sell the power into the grid or to a particular end utility, or to a particular company at a fixed price over 10 or 15 or 20 years. Voilà! But the extension of the federal investment tax credit didn’t remove the regulatory uncertainty that hangs over the residential rooftop business model.

Rooftop solar—putting a dozen panels on the roof of a home and then selling or leasing the system to the homeowner—has a fundamentally different model than utility-scale solar. You lose the economies of scale—the per-unit cost of installing 50,000 solar panels in empty land in the desert is much lower than the per-unit cost of installing 15 panels on the roof of a house in the desert. What’s more, homeowners with rooftop solar still have to buy electricity from the utility at night. And they may produce excess unused power during the day when nobody is home.

To help the industry grow, regulatory commissions and utilities in most states have developed so-called net-metering policies, which allow owners of rooftop solar systems to sell the excess power they produce to the power company. That helps defray the costs.

While solar companies and their customers love net metering, utilities hate it. These for-profit companies have to fund and maintain the infrastructure that can deliver electricity to every home on the grid, 24 hours a day, and at a fixed price. But customers who go solar sharply reduce their power purchases and extract revenues through net metering. Utilities only recoup some of those costs through a fixed monthly fee that all electricity customers pay simply for the privilege of being connected.

Net metering wasn’t much of an issue for utilities when rooftop solar was a cottage industry. But residential rooftop installations grew 69 percent in the third quarter of 2015 from the third quarter of 2014. By the end of the third quarter of 2015, SolarCity counted 160,000 residential customers in the United States. Vivint Solar, the second-largest residential company, had installed some 60,000 units by the end of September.

Nevada’s market has been growing rapidly, thanks to local conditions—lots of sun, lots of rooftops without tree shade, a favorable net-metering policy. Vivint set up shop there in July. And by the end of last year, some 17,000 residents had solar on their rooftops.

In late December, the Nevada Public Utilities Commission, as is its right, changed the rules on how utilities operating in the state must treat solar net-metering customers. First, it said utilities could jack up the fixed monthly charge from $12.75 to $17.90—an increase of $5.15 per month, or about $62 per year for solar customers—and then increase it to $38.51 by 2020 (a threefold increase). The NPUC also decreed that those feeding power into the grid would henceforth get a smaller credit—instead of paying 11 cents per kilowatt-hour, utilities would only have to pay 9 cents per kilowatt-hour, an 18 percent reduction. Those charges would fall rapidly to 2.6 cents per kilowatt-hour by the beginning of 2020. What’s more, these new rules wouldn’t apply only to new solar customers; they’d apply to people who installed their panels last year, or two years ago.

The decision is devastating for rooftop solar in Nevada. Solar is a business that relies on cash flow. The people (or companies) that own rooftop solar panels will have to spend lots more money each month just to be connected, and will receive much less money than they anticipated for the excess power they produce. It makes what was a great deal a pretty bad deal. Even with the federal tax credit intact, the economics behind rooftop solar no longer make sense in Nevada. And so in the first week of January, SolarCity announced it would be leaving Las Vegas and the rest of Nevada; it fired 550 workers and closed a training center. Vivint said it is terminating operations in the state, and solar installer Sunrun left as well. The dramatic moves are both an effort to get Nevada’s political and regulatory system to respond and a recognition that they simply can’t sell their product under the new pricing regime.

Moves like Nevada’s are bad for the growth of the rooftop solar industry. And they’re bad news for the stocks of big rooftop solar companies. Investors, having realized that state regulatory agencies can instantly render the business case for rooftop solar unworkable, have pushed SolarCity’s stock off by about a third in the past month.

And it highlights a larger truth about the industry. In many ways, solar and other renewables have grown into a large, mature industry—with lobbying clout and access to the capital markets. The recently issued Solar Foundation census found there are some 208,859 solar jobs in the U.S., up 20 percent in the past year. The heft has given the industry clout in Washington and in many state capitols. But the bigger rooftop solar gets, the more it threatens utilities. Those regulated companies, which have decades of experience in the trenches of state politics and legislation, are forces in their own right. And they’re not going to make things easy for the upstarts. A large utility in Arizona, another solar hotbed, is seeking permission to mimic Nevada’s program of higher interconnection fees and lower net-metering rates.

Solar’s federal battle may have been won. But the war in the states is just beginning.