President Bush on Tuesday shut a loophole that defense contractors had been using to avoid paying millions of dollars in payroll taxes.

Bush signed into law the Heroes Earnings Assistance and Relief Tax Act, which provides tax relief for military families. Included in the legislation is a provision that would treat foreign subsidiaries of U.S. government contractors as American employers. That means they now have to pay the taxes that finance Social Security and Medicare programs.

Defense companies such as Combat Support Associates and KBR Inc. set up shell companies in the Cayman Islands and other tax havens to avoid paying those taxes on their American workers.

In May, The Associated Press reported that Combat Support Associates, which has offices in Orange, Calif., created CSA Ltd. just months after winning a military support contract that has totaled more than $2 billion.

But there's scant evidence that CSA Ltd. exists. There's no listed office address or phone number in the Cayman Islands, which is a British territory. Records show the corporation is registered with Close Brothers, an investment house in the Caymans.

Lawmakers wanted to end the practice, which has become widespread among American businesses. The Senate Finance Committee estimates that thousands of companies have registered in the Caymans to dodge taxes. The losers, the committee said, are ordinary Americans who foot a larger share of the bill to pay for programs that benefit the elderly and the disabled.

Democratic presidential candidate Barack Obama said in March that setting up shell companies "turns the idea of patriotism on its head."

The Joint Committee on Taxation estimates that shutting the employment tax loophole would bring in about $846 million in revenue over 10 years.

"By reining in tax-dodging private contractors who use gimmicks to avoid their basic responsibilities, this Congress chose good governance and accountability over cronyism and favoritism," said John Krieger of U.S. PIRG, a federation of public interest groups, on Tuesday.