Late last Monday, the American Civil Liberties Union of Colorado filed a lawsuit in State District Court here arguing that by seizing and retaining confidential tax information, the Weld County authorities had violated privacy rights of thousands of taxpayers.

“If the sheriff and the D.A. can comb through thousands of records in a tax preparer’s office on the theory that some of their clients are doing something wrong, then none of our confidential information is safe,” said Mark Silverstein, the legal director for the group.

Mr. Buck said all information from the investigation would be kept confidential.

Both sides agree that the issue has exposed a hole in federal immigration policy. Since 1996, the I.R.S. has distributed about 15 million Individual Taxpayer Identification Numbers to enable people without Social Security numbers to pay taxes. Many illegal immigrants also buy fake or stolen Social Security numbers on the black market to show to potential employers.

Image They are committing felonies through identify theft, District Attorney Ken Buck said. Credit... Kevin Moloney for The New York Times

While not commenting specifically about the Colorado operation, an I.R.S. spokesman, Frank Keith, said, “We are concerned when information provided by taxpayers to meet their legal tax obligations is used for purposes other than federal tax administration.”

Sheriff Cooke said the federal policy was tantamount to “the government turning its back on victims of identity theft.”

If a stolen or false Social Security number is used only to get work, “there is no negative impact on the rightful owner,” said a Social Security Administration spokesman, Mark Hinkle; but it can wreak financial havoc if used to gain access to bank accounts or to obtain credit cards.