Sometimes when the gods wish to punish us, Oscar Wilde quipped, they answer our prayers.

He could have been speaking directly to Spain’s old guard publishers in their fight against Google. The latest target: Google News. The Spanish Association of Daily Newspaper Publishers lobbied hard for a law that would charge services such as Google News for showing one- and two-sentence excerpts from their articles, the snippets that preview what a user is about to click on. The law passed and the fees were supposed to go into effect Jan. 1.

Here’s a lesson for any European lobby or regulator tempted to copy Spain’s example: Laws that single out foreign firms function best when those firms are expected to either fight publicly or fold quietly. But Google neither planned to lawyer up nor pay up. Instead, Google did what many a civil disobedient has done in the face of many an unfair, unfounded law: It embraced a kind of passive resistance, preferring to simply shut down its Google News service rather than pay a link tax.

Visitors to the site were met with an explanation from Richard Gingras, head of Google News. “This new legislation requires every Spanish publication to charge services like Google News for showing even the smallest snippet from their publications,” he wrote. “As Google News itself makes no money (we do not show any advertising on the site) this new approach is simply not sustainable. So it’s with real sadness that ... we’ll remove Spanish publishers from Google News, and close Google News in Spain.”

Here’s another lesson for European lobbies and regulators: When your opponent unexpectedly snatches the moral high ground, don’t make rash moves to regain it. Which is, of course, exactly what Spanish newspaper publishers did. With free traffic from Google at risk, AEDE appealed to the government to forcibly prevent Google News from shutting down. “[Google News’ closure] will undoubtedly have a negative impact on citizens and Spanish businesses,” the association announced. “Given the dominant position of Google (which in Spain controls almost all of the searches in the market and is an authentic gateway to the Internet), AEDE requires the intervention of Spanish and community authorities, and competition authorities.”

It was a spectacular piece of PR for Google — and a colossal failure for the AEDE and the politicians sympathetic to it. As one commentator observed on Twitter, “Spain is basically announcing to the world over a megaphone, ‘Run don’t walk from trying to do anything innovative here.’ ” Gizmodo’s Carlos Rebato, a Spaniard, expressed the embarrassment of his digitally savvy countrymen, writing, “There are strange moments when you feel ashamed not as an individual, but as a member of a collective, of something bigger. In my case, today, it’s of being Spanish. And what I feel right now is a deep, profound sense of ridiculousness.”

Ridiculousness, indeed. It would have been bad enough if the link tax, which was aimed at Google, affected the search giant alone. But it doesn’t. Any site linking to any publishers’ content could be forced to pay up. Smaller firms have already predicted layoffs, and the uncertainty has put others on guard. And as for the traffic, some estimates indicate a net 10 to 15 percent decline in traffic to publishers as a result of the Google News shutdown — including traffic to some new media entities unsympathetic to old media’s gripe with Google.

Spain’s “Google tax” is remarkable in many respects, not least in the very public manner in which it backfired (just as similar moves in Germany and Belgium failed). But in some ways, the Spanish law is in entirely in keeping with the general hostility toward Google in Europe. After all, the company has been subjected to repeated investigations, lawsuits, and regulatory action by the EU and national governments, questioning everything from whether its dominance of search queries violates antitrust law to whether Google itself deserves to be broken up.

As of this writing, Google remains a single entity, and it still commands over 90 percent of all European search queries. Which brings us to a final, crucial lesson for European lobbies and regulators: Time and money spent trying to defeat Google is time and money not spent addressing the underlying issues that prevent Europe from building Googles of its own. What issues? Antique bankruptcy regimes. A weak venture capital environment. Retrograde labor laws. There are clear and specific reasons why Europe has lagged in the development of startups, why the Economist once described European culture as “deeply inhospitable to entrepreneurs” and likened scaling a business there to something “as countercultural as piercings and performance arts.”

Those issues deserve to be addressed. As for the example of Spain and the closure of Google News, perhaps we can give the last word to Mr. Wilde, too: Experience is the name everyone gives to their mistakes.