Citizens in the US voted for Jim Crow and it was only overturned via non-democratic means. Were these laws moral at the time?
To take a modern example, will Maharashtra's proposed law against Biharis driving autos be moral if it has popular support? (Background: Marathi nationalists have - this year - proposed Jim Crow type laws against non Marathis driving taxis/auto rickshaws.)