The US Department of Housing is to sue social media giant Facebook for what it has claimed were discriminatory advertisements.
In a statement, the department said Facebook violated the US Fair Housing Act by allowing parties to limit their audiences on the basis of race, ethnicity or gender.
The action followed an investigation of a complaint filed in August 2018.
The US department alleged that Facebook unlawfully discriminated based on race, colour, national origin, religion, familial status, sex and disability by restricting who can view housing-related ads on its platforms and across the internet.
It also claimed that the social media site "mines extensive data about its users and then uses those data to determine which of its users view housing-related ads based, in part, on these protected characteristics."
Ben Carson is secretary of the US Department of Housing and Urban Development (HUD).
He said: "Facebook is discriminating against people based upon who they are and where they live.
"Using a computer to limit a person's housing choices can be just as discriminatory as slamming a door in someone's face."
HUD General-Counsel Paul Compton added: "Even as we confront new technologies, the fair housing laws enacted over half a century ago remain clear—discrimination in housing-related advertising is against the law.
"Just because a process to deliver advertising is opaque and complex doesn't mean that it’s exempts Facebook and others from our scrutiny and the law of the land."
The Fair Housing Act prohibits discrimination in housing and housing-related services - including online advertisements - based on race, colour, national origin, religion, sex, disability or familial status.
According to the HUD's charge, Facebook enabled advertisers to exclude people who Facebook classified as parents; non-American-born; non-Christian; interested in accessibility; interested in Hispanic culture; or a wide variety of other interests that closely align with the Fair Housing Act’s protected classes.
HUD is also alleging that Facebook allowed advertisers to exclude people based on their neighbourhood, by drawing a red line around those neighborhoods on a map.
Facebook also allegedly gave advertisers the option of showing ads only to men or only to women, HUD said.