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.”