An operation in 2004 meant to disrupt potential terrorist plots before and after that year's presidential election focused on more than 2,000 immigrants from predominantly Muslim countries, but most were found to have done nothing wrong, according to newly disclosed government data. The program, conducted by the Department of Homeland Security, received little public attention at the time. But details about the targets of the investigation have emerged from more than 10,000 pages of internal records obtained through a lawsuit by civil rights advocates. Parts of the documents were provided to The New York Times. The documents show that more than 2,500 foreigners in the United States were sought as "priority leads" in the fall of 2004 because of suspicions that they could present threats to national security in the months before the presidential election and the inauguration. Some of those foreigners were detained and ultimately deported because they had overstayed their visas, but many were in this country legally, and the vast majority were not charged. The internal reports show that immigration agents questioned the foreigners about what they thought of America, whether violence was preached at their mosques, and whether they had access to biological or chemical weapons. A sampling of 300 cases turned over by federal officials showed that none of those interrogated were charged with national security offenses. Fewer than one in five were charged, most of them with immigration violations. A spokesman for Immigration and Customs Enforcement, Richard Rocha, would say only, "Due to ongoing litigation, ICE is not at liberty to provide any comment." Officials said they were not aware of any similar programs now under way. At the time of the 2004 operation, the immigration agency said publicly that it was tracking leads in an effort to disrupt potential terrorism plots, but emphasized that its investigations were being conducted "without regard to race, ethnicity or religion."But the records showed that 79 percent of the suspects were from Muslim-majority countries, according to an analysis by students at the National Litigation Project at Yale Law School, who obtained the records, as did the American-Arab Anti-Discrimination Committee. Each group sued for the records under the Freedom of Information Act, and both say the operation showed that the government was using ethnic profiling to identify terrorism suspects. "This was profiling," said Michael Wishnie, a professor at Yale Law School who helped lead the research effort. He added that the findings raised questions about both the effectiveness and the propriety of the program. "The resources devoted to this were enormous," he said, "but the results clearly were not."