The cash-strapped Spanish government has granted itself powers to raid solar-panel owners’ properties to make sure that citizens are complying with its attempt to tax energy citizens get from their own solar panels — effectively taxing use of the sun.

In new regulations, reported by English-language Spanish news site The Local, officers of Spain’s Industry Department now have the ability to “raid” any property they suspect has fallen afoul of the law. If the resident refuses to allow access to their property, the Industry Department can then get a court order to raid the house by force.

Spain is one of the global leaders in solar production. Aided by the Mediterranean climate and healthy subsidies by the former socialist government, as many as five thousand Spanish homeowners took advantage of outfitting their properties with solar paneling after private energy generation — known in Spain as autoconsumo — was legalized in 2011. As Spain has suffered during the economic downturn in Europe, those who have invested in the solar power saw it as a way to ease household expenditure. But with a change in government, has come a change in attitude with the ruling Popular Party now regarding these successful solar pioneers as freeloaders.

Once a raid has been carried out by the Industry Department, officials are authorized to seize any and all documentation relating to energy consumption and seal off the property. If a resident is found to have been generating more energy than they have paid tax, or they have not hooked up their private solar panels to the national grid, they can be fined for as much as €30 million ($41 million).

The Wall Street Journal points out that a fine of that size is “equivalent to what a nuclear-power producer might pay for a radioactive leak that endangers public safety.”

Speaking to the Australian Business Spectator, Industry Minister Jose Manuel Soria, who introduced the law, said, “I support ‘autoconsumo’ [independent power generation by households] … but the power system has infrastructure, grids that the rest of us Spaniards who are in the system have to pay for. And we pay for it through our electricity bill.”

Former Spanish Secretary for the Environment Teresa Ribera hit back, saying, “It’s like asking cyclists to pay a levy to keep open the petrol stations they don’t use.”

José Donoso, the director general of Spain’s largest solar industry trade association, said of the law, “It’s like buying a more efficient refrigerator that uses less electricity and having to pay a charge for what you’re no longer buying from the electrical system,”

The reason for the draconian new law is strictly to raise funds to help the cash-strapped government pay its bills. Spain owes €26 billion ($34 billion) in debt that it has racked up regulating energy costs and prices, and it owes this sum to the Spanish power production companies.

The government’s fear is that autoconsumo, combined with the practicality of using solar power in Spain, will allow more and more Spaniards to exit the national power grid, leaving the cost of maintaining it on an ever decreasing number of consumers. The Energy Law’s aim is to stem that tide and harshly punish those who flout it.

But that argument fell flat with Forbes. In the August issue of its magazine, one article read, “You get the feeling that government officials were out of ideas, stared up at the sky one day and thought, ‘I’ve got it! We’ll tax the sun!'”

The law has been criticized widely both in Spain and outside. Online Spanish newspaper VozPopuli consulted lawyers who argued that the law may not even be constitutional. The European Union has been shocked by the moves Spain has made, which run counter to the green and renewable energy agenda of other member states such as Germany.

Follow Grae on Twitter