The Department of Housing and Urban Development charged Facebook Thursday with violating the Fair Housing Act through its targeted advertising practices.

HUD alleges that Facebook’s advertising discriminated on the basis of color and race.

"Facebook is discriminating against people based upon who they are and where they live,” HUD Secretary Ben Carson said in a statement. “Using a computer to limit a person’s housing choices can be just as discriminatory as slamming a door in someone’s face.”

The charge follows a months-long investigation by HUD into whether Facebook illegally allows real estate sellers to restrict their advertisements by characteristics such as race. Facebook earlier this month agreed to enact sweeping reforms to its ad-targeting system as part of a settlement with civil rights groups alleging similar complaints. The rights groups, including one dedicated to housing, alleged the tech giant allowed advertisers to discriminate against marginalized groups. As part of that settlement, Facebook will no longer allow advertisers to target or exclude housing ads by age, gender or zip code, and it also removed hundreds of targeting options for anyone selling housing, credit or employment opportunities. The company as part of the settlement also said it will create a new portal to allow users to search for and view housing ads in the U.S. regardless of who the advertisers hoped to target. (The Hill)

Facebook said they were “surprised by HUD’s decision.”

"We've been working with them to address their concerns and have taken significant steps to prevent ads discrimination," a Facebook spokesperson said after the charge on Thursday. "Last year we eliminated thousands of targeting options that could potentially be misused, and just last week we reached historic agreements with the National Fair Housing Alliance, ACLU, and others that change the way housing, credit, and employment ads can be run on Facebook."

"While we were eager to find a solution, HUD insisted on access to sensitive information - like user data - without adequate safeguards," the spokesperson added. "We're disappointed by today’s developments, but we’ll continue working with civil rights experts on these issues.”