On a typical day, thousands of passengers pull into Luxembourg’s central train station and traverse the busy shopping street of Rue de la Gare, where everything from pastries to rain boots is on offer. Few, however, step inside the covered walkway next to the hair salon at No. 41. If they did, they’d find little but mailboxes, dozens of them, affixed to the wall. On a chilly afternoon in early January, the mailbox marked AIG/Lincoln—the name of a partner of the New York–based insurance and real estate giant AIG—is empty and unlocked. Moments later, in the company’s fifth-floor office, I meet AIG/Lincoln’s employee (introduced as the sole one), who, as it happens, also works for the roughly 30 other companies housed in the modest suite. When I ask how one works for dozens of bosses, the response is, “It is not very hard. There are no activities here.”

If politicians in the U.S. and Europe get their way, things in this pinprick of a country could get even quieter. Luxembourg, to state the obvious, is small—so tiny that if you drive a half-hour out of the capital, Luxembourg City, you are likely to hit Belgium, France, or Germany. Much of its population of 550,000—about the same as Tucson—is clustered around a centuries-old hillside capital, where the world’s last remaining Grand Duke (the country is a Grand Duchy) lives in a palace. Its stone fortifications have been fought over through the ages, from the time of ancient Rome to the Napoleonic wars.

Now the country is facing a fresh battle for empires—this time, multibillion-dollar conglomerates. Some European as well as U.S. politicians are accusing Luxembourg of acting as a haven for egregious corporate tax dodgers, and they are demanding reform. At stake is the legal ability of companies, including hundreds of U.S. corporations, to park sizable chunks of their business outside their home countries, cutting billions from their tax bills.

Luxembourg is not the only place to capitalize on the tax-law loophole that allows this: So, too, do Ireland and the Netherlands, among others. Yet unlike those business hubs, Luxembourg’s economy depends almost entirely on its fiscal appeal, a reality wrought of bitter necessity. When the country’s bedrock steel industry collapsed in the 1970s, Luxembourg began offering companies huge incentives to move there. Sweeteners included streamlined bureaucracy and, more crucially, deep discounts on the country’s corporate tax rate of 29%.

The strategy has paid off, and then some. Luxembourg-based mutual funds now have more than $3 trillion under management, up from about $760 billion in 2001. Only funds in the U.S. have more assets. There are 148 banks from 27 countries in the capital city, and more than 40,000 companies are registered in the country (about one for every eight residents), including more than 200 U.S. companies, with household names like PepsiCo PEP and Heinz. Direct U.S. investment in 2013 was $416 billion. Buy a book on Amazon AMZN in Europe, and the legal page announces the company address in Luxembourg. Download a song on iTunes anywhere in Europe, and a small-type notice says you have just done business with a company situated on Luxembourg’s Rue Sainte-Zinthe.

So where is this bustling Apple AAPL enterprise based? Down a sleepy side street across from a convent and a senior citizens’ home. There, a sticker on a doorbell outside a five-story building reads itunes. After Fortune rang the bell, a woman in Ugg boots came out to say there was no one to talk to in Luxembourg.

The serene atmosphere might have lasted for years had it not been for two events. First there was the global recession, which forced governments to hunt for more tax revenue. Then, in November, came the release of thousands of documents from Luxembourg’s auditing companies—including many stolen by a PricewaterhouseCoopers employee in his twenties who copied them onto a flash drive and passed them to a journalist. The media ran with the story.

Dubbed LuxLeaks, the revelations ignited global outrage. The data dump suggested that auditing companies like PricewaterhouseCoopers and EY had crafted structures for giant corporations that effectively saved them from paying billions in taxes back home. One beneficiary, it appeared, was AIG/Lincoln, which AIG AIG formed as an investment vehicle to acquire real estate in Europe. Documents showed that in 2010, Luxembourg issued a tax ruling to PwC the very same day it deposited AIG/Lincoln’s plan for a complex transfer arrangement. (A spokesman for AIG denied receiving any special treatment, and PwC’s tax chief in Luxembourg said lightning decisions are not unusual because details are hashed out with authorities in advance.)

While all the activity the leaks disclosed was completely legal, the popular takeaway was that Luxembourg had for years rubber-stamped dream tax deals for hundreds of giant companies, no questions asked.

In January, inside PricewaterhouseCoopers’s gleaming new office building in Luxembourg (it opened days before the scandal broke), with its soaring atrium and glass-walled offices, the company’s executives were still fuming about the LuxLeaks affair. Over coffee, PwC managing partner Didier Mouget told Fortune the company has been unjustly criticized simply for representing its clients’ best interests. “The majority of transactions are not to escape or evade taxes,” he says. “They are designed to avoid double or even triple taxation.”

In any case, changes are underway. Last year the G-20 countries agreed to share their tax rulings with other governments, and in January, Luxembourg ended its long practice of bank secrecy. The European Union is probing whether Amazon’s favorable Luxembourg tax arrangements amount to state aid, in violation of European law—a charge that Drew Herdener, Amazon’s vice president for strategic communications in Luxembourg, denied in an email, saying the company was “subject to the same tax laws as other companies operating here.”

The EU effort is aimed at closing loopholes that have driven corporate tax bills steadily down, in many cases close to zero. “As long as you have massive loopholes, companies will use them,” says Pascal Saint-Amans, head of the Center for Tax Policy and Administration at the Organization for Economic Cooperation and Development. Following that momentum, in January, the EU forced companies to pay sales tax in each country in which customers made digital purchases—a major blow to Luxembourg, which had lured a huge e-commerce business with the country’s modest 3% sales tax.

Many Luxembourg executives are now grumbling that if the EU wants the duchy to change its tax rules, then the rest of the world’s tax havens should do the same. Asked about sweetheart corporate deals, Nicolas Mackel, CEO of Luxembourg for Finance, a quasi-government business promotion company, responded: “Go check Delaware.” 

This story is from the February 2015 issue of Fortune.