SO Facebook eventually caved in and admitted to a form of digital discrimination, which at its worst threatened to unpick America’s civil rights legislation. You could hear the thunderous voice of Dr Martin Luther King raging from the grave.

After intense legal wrangling, Facebook in the USA has settled in three civil rights cases and two Equal Employment Opportunity complaints over discriminatory advertising on its platform.

As part of the settlements, Facebook has agreed to make changes to its notorious “black-box” of data. It is being forced to adjust settings on advertising tools in order to restrain advertisers from targeting users based on their race, gender, age and disability.

Now, some of you might already be jumping to the wrong conclusions – advertising is all about demographics. Invariably companies define us by age, gender, race and disability – selling lip-gloss to a 65-year-old man is pretty futile and trying to flog mince rounds to a vegan would be a tough gig.

There are products and long-standing advertising campaigns that clearly use age as a profile. Stannah Stairlifts and convenience bath-seats are traditionally shown within daytime television, where the watching demographic is older.

All forms of advertising are to some extent dependent on the data that the media can collect about its readers, viewers and social-users.

But Facebook has been found guilty of abusing data in the heartlands of civil rights: the housing market and job advertising. Five separate cases were lodged against Facebook by the National Fair Housing Alliance, Communications Workers of America, regional fair housing organisations and individual consumers represented by the formidable American Civil Liberties Union (ACLU), which for almost 100 years has worked to defend the rights and liberties guaranteed by the US Constitution.

One of the cornerstones of civil rights was the Fair Housing Act of 1968. The passage of the Bill was greeted as a high point in social change and there was a presumption that systematic discrimination in housing was a thing of the past and that segregation would end.

Stevie Wonder knew otherwise. In the mid-60s he became internationally famous when his song Uptight (Everything Is Alright) became a global hit. For the first time in his life, the blind child prodigy was comparatively wealthy and, like many people from deprived upbringings, his first objective was to buy his mother her first real home.

The National: Stevie Wonder was the original blockbusterStevie Wonder was the original blockbuster

For decades, Detroit had been blighted by discriminatory housing policies and whole sections of the city were still segregated. A local practice called “red-lining” was in operation. Estate agents and mortgage lenders drew red- lines on a map of Detroit and determined which areas of the city would be occupied by white homeowners and which areas by African Americans.

Mortgage lenders agreed only to issue loans according to the red lines, and so a new form of discrimination emerged. Housing was theoretically open to anyone, but loans were only available in certain neighbourhoods.

Stevie Wonder, working in tandem with local civil rights activists, identified a home in Greenlawn Street – then a cloistered neighbourhood of middle-class white residents. The area was “red-lined” and so no loan was available to African American buyers, but with the royalties coming in from the global sales of Uptight Stevie Wonder was a cash buyer and didn’t need a loan.

He bought his mother the house with cash and she became the first black resident in a historically all-white street. Civil rights groups called the change block-busting, and as the story spread to local radio stations Uptight became known as a blockbuster, a term we now use casually to indicate a hit record.

Red-lining was a crude analogue version of what Facebook has been accused of doing in the digital world. It participated in actions that were in effect a barrier to open housing, and their advertising algorithms were manipulated to send adverts for real estate to people according to their ethnicity.

The practice was intended to discourage African-American or Hispanic families from buying in wealthy all-white neighbourhoods. Prospective buyers were in effect screened by race.

IN other cases, people seeking to buy in the new-build condominium market had adverts blocked from their search if they had shown an interest in wheelchairs and disability ramps, raising the horrendous thought that new-build housing wanted to discourage disabled buyers, presumably because they might demand higher standards of disability access or costly adjustments to interiors like bathrooms and kitchens.

Facebook was caught with its pants down and it has been forced to admit that the data they held on users was being “inadvertently” used to discriminate.

You are welcome to judge how inadvertent the practice actually was. Facebook claim they were unaware of how their own advertising algorithms were being manipulated. My own instinct is that it is further proof of the free-market recklessness of social media advertising and the pursuit of clicks and sales over social responsibility.

Our thanks for exposing the questionable online practice goes to ProPublica, the not-for-profit newsroom, which led the investigation. Their mission statement is worth referring to in full: “To expose abuses of power and betrayals of the public trust by government, business, and other institutions, using the moral force of investigative journalism to spur reform through the sustained spotlighting of wrongdoing.”

In much the same way that the UK currently views most politics through the prism of Brexit, everything in America seems to return with rattling simplicity back to President Trump. Facebook’s legal defeats – five in number – and their hedged admission of culpability was seen by some as a defeat for Trump. His support for the free market and his tetchy indifference to the extension of civil rights was at the core of the issue.

Facebook’s defeat in US courts has exposed yet again the failures of social media moderation. It is no great coincidence that they came in the same week as the white supremacist atrocities in Christchurch. Facebook’s live stream function was used by the killer to simultaneously broadcast his pathological hate.

While Facebook deleted some of the killer’s gruesome actions, many more escaped their porous controls, moving into other social media streams. YouTube’s deletion was equally exposed. Its staff succeeded in “hashing” their database to block and impede sharing of the killer’s video but it was easily spliced into episodes and re-posted like a gruesome soap-opera.

What we can be sure about is that the simultaneity of the Christchurch killings and US discrimination cases will heap further pressure on Facebook to clean up its live-streaming protocols and embrace greater transparency in the workings of its advertising engine.

But you can also be sure that Facebook will adapt. Like kangaroo rats that adapt in the desert without drinking water, the moguls of social media will morph, reconfigure and complicate their technologies.

According to the left-leaning magazine Mother Jones, Facebook has already proposed a solution. It aims to create a separate portal for ads in the areas of housing and employment and will limit the number of targeting categories available to advertisers. This offsets the problem, but it doesn’t solve it.

What is not clear is where the next wave of pressure on Facebook will come from – users, politicians or the press? Traditional forms of media such as commercial radio, television and the printed press should be over these issues like a rash. At long last the social media mechanisms that have laid waste on the advertising incomes of traditional media have been exposed to be unfair, discriminatory and biased.

That is a weapon that old media should use in a battle that most people imagined was already lost.