The US Department of Justice has accused Facebook of discriminating against American workers by giving hiring preferences to immigrants.
A lawsuit alleges the social media firm refused to recruit, consider or hire qualified and available Americans for more than 2,600 positions.
Those jobs instead went to foreigners on temporary visas, the lawsuit says.
Facebook disputed the allegations, but said it was co-operating with the department.
The lawsuit concerns Facebook’s use of temporary H-1B visas, which are often used by tech companies to bring highly skilled foreign workers to the US.
In its lawsuit, filed on Thursday, the department alleged that Facebook “intentionally created a hiring system” that favoured H-1B visa holders and other temporary workers over Americans.
The department said it filed the lawsuit after a two-year investigation into Facebook’s hiring practices.
The lawsuit seeks “back pay on behalf of US workers denied employment at Facebook” among other remedies.
“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,” said Eric S Dreiband, the assistant attorney general for the department’s civil rights division.
“Our message to all employers – including those in the technology sector – is clear: You cannot illegally prefer to recruit, consider or hire temporary visa holders over US workers.”
Analysis: Securing Trump’s legacy
By Samira Hussein, BBC business reporter, New York
US President Donald Trump may not have publicly accepted the outcome of the election, but it has not stopped his administration from trying to secure his legacy before he leaves the White House in January.
They have been drafting new rules and policy changes that support his agenda of the last four years, and make it more difficult for the incoming Biden administration to reverse.
Throughout his tenure, the president has tried to make it more difficult for companies to hire foreign workers using the H1-B visa programme. Silicon Valley is particularly dependent on these work permits but Mr Trump has long argued they are used to the detriment of American workers.
This particular lawsuit against Facebook is more of the same, a way to restrict foreign workers being hired by US companies. It’s a last ditch effort by a lame duck president.
The Trump administration has had a strained relationship with tech firms in recent years. Big companies such as Facebook have faced criticism for allowing disinformation to be spread on their platforms and data to be misused.
Complaints of anti-competitive practices have also been levelled at the largest tech companies in the US by Democratic and Republican lawmakers.
In October, the Justice Department sued Google, accusing it of illegally maintaining its monopoly power in search and search advertising. Google denied the allegations, calling the litigation deeply flawed.
A few weeks before that, the House Judiciary Committee recommended taking action to break up the big-tech platforms, including Facebook, Amazon, Apple and Google.
Facebook has previously said it is not a monopoly and consumers can choose how to connect with friends online.