The men, known as "Chibanis" after a north African Arabic term for old men, were some of the roughly 2,000 Moroccans recruited in their home country by the SNCF in the 1970s, to make up for labour shortages in France as the rail network was expanding.
Following a deal signed with the newly independent kingdom in 1963, company recruiters went to areas that had a reputation for supplying good soldiers to fight for France in World War II, conducting interviews and medical examinations there and signing contracts at the Moroccan immigration office in Casablanca.
But the contracts did not give the new employees, who were shipped to France across the Mediterranean, the full rights of SNCF employees, allowing them restricted social protection, limited career opportunities and lower retirement pensions.
Several of the men involved in the case complained of being particularly shocked when they found they had old age pensions of about 1,000 euros a month, far lower than their colleagues.
SNCF appeal thrown out
An appeal court in Paris on Wednesday threw out the rail company's appeal against a 2015 labour court's award of 170 million euros to the workers in compensation for discrimination.
"It's a great relief, a great satisfaction," commented their lawyer Clélie de Lesquen-Jonas after the judgement.
The legal battle has been going on for years, with a report by the government's integration council recommending limited compensation in 2004.
The amount of compensation awarded by the appeal court was not immediately made public.
The plaintiffs had asked for a total of 628 million euros.
The SNCF said that it would examine each case individually and might appeal to the country's highest appeals court.
As well as Moroccans, workers from other African countries, especially Mali and Senegal, and some Chinese were employed on similar contracts in the post-war period.
The Netherlands has also been accused of discrimination against Moroccan workers.