The Justice Department on Thursday sued Facebook over allegations that it discriminated against Americans in the way it hired temporary foreign workers for thousands of well-paid positions.

The lawsuit contends that Facebook failed to properly advertise at least 2,600 jobs — and consider applications from U.S. citizens — before it offered the spots to foreign workers whom the tech giant was sponsoring for green cards granting permanent residence.

Facebook’s practices violated federal laws that require employers to demonstrate that there are no qualified U.S. workers available before it offers positions to temporary foreign workers it is sponsoring, the Justice Department said. The government sought unspecified monetary damages and other penalties against the tech giant for the alleged violations, which occurred in 2018 and 2019.

“Our message to workers is clear: if companies deny employment opportunities by illegally preferring temporary visa holders, the Department of Justice will hold them accountable,” Eric S. Dreiband, assistant attorney general for the Civil Rights Division, said in a statement.

Facebook said it could not comment on the now-pending litigation, but spokesman Andy Stone said in a statement the company had been cooperating with the Justice Department fully on its probe and disputes the allegations in the complaint.

The lawsuit reflects the long-running war between the Trump administration and the tech industry over immigration. In his four years in office, Trump has instituted a range of policies that crack down on foreign travelers, immigrants and workers, often drawing sharp rebukes from Facebook and its digital peers in Silicon Valley, which have challenged the U.S. government repeatedly in court.

Facebook, in particular, long has sought to expand the ranks of high-skilled foreign laborers in the United States, including programs such as the H-1B visa, as they aim to recruit the critical talent necessary to power their highly technical operations. Trump, however, has sought to restrict such programs in recent months — announcing in October, for example, new limits on the visas that later drew broad corporate blowback.

In its complaint, the Justice Department said Facebook has eschewed its traditional hiring process in cases where it wanted to hire an employee on an H-1B visa for a permanent position. When a temporary visa holder sought such a job, Facebook “diverged from its normal recruiting protocols," according to the government, opting in some cases against “advertising the position on its external website.”

If a U.S. worker applied for one of these jobs — and Facebook determined they were qualified — the company appeared to hire them in a different capacity, the lawsuit found. Federal law generally only allows a company to sponsor a temporary worker for a permanent position in cases where there is no qualified U.S. applicant.

“Facebook knowingly and intentionally deterred U.S. workers from applying to and failed to meaningfully recruit U.S. workers for its PERM-related positions, when it subjected such applicants to more burdensome recruitment procedures because it preferred to employ temporary visa holders in those positions, because of their citizenship or immigration status,” the government said.

H-1B visas are, officially, temporary benefits for highly skilled workers. That includes doctors, I.T. professionals, engineers and others, and American companies say the visas are critical to attracting the best and the brightest from abroad to job sectors that don’t have nearly enough Americans to fill openings.

In practice, however, a disproportionate number of H-1B visas go to workers in the tech sector, including companies like Facebook; the visa holders are disproportionately Indian nationals. The expectations of both the employers and, especially, the visa-holding employees are that the visas are anything but temporary.

Despite President Trump’s general opposition to immigration, and his administration’s efforts to scale back legal immigration across much of the immigration system, H-1B visa distribution did not actually slow down under Trump. Immigration attorneys complain that the approval process has acquired additional hurdles and takes longer. But quantitatively, more H-1B visas were distributed: The Trump administration issued 188,123 such visas in fiscal year 2019 — 8,000 more than were issued in fiscal 2016 under Barack Obama.