ARE white working-class men to blame for Brexit and Donald Trump? Well, they voted for him in large numbers, and his brash style obviously appeals to some who feel left behind by the march of feminism and racial equality. In America at least, the red-neck, rust-belt white man has become almost an object of hatred among the urban, coastal middle classes, who are appalled that a bigot could become president.

But it wasn't only white men – a majority of white women also voted for Donald Trump, many of them working-class. Feminists like the Guardian's Suzanne Moore have tried to explain this by suggesting that they are misogynists in spite their gender. Or that they have some form of internalised oppression – a bit like the old Marxist concept of “false consciousness”.

Actually, the reality is that most Trump and Brexit voters, male and female, were not working-class at all. Wealthier classes voted in greater numbers both for the US President elect, and to leave the EU. Nevertheless there is a general assumption now – on the right and the left – that the white working classes in the UK and USA have become repositories of racial and homophobic hatreds.

“What is wrong with the working class?” asks Moore. Fellow feminist columnist, Laurie Penny, says we should stop making apologies for them. She condemns the “craven consensus that the white working class is a homogeneous mass of blustering bigots who must be pandered to as one might pander to a toddler having a tantrum”.

There's certainly evidence of working-class sexism, racism and domestic violence on a grand scale in books like the current bestseller Hillbilly Elegy by JD Vance – a grim first-hand account of growing up in a chaotic Scots-Irish working-class family in Ohio. There has certainly been an uptick in reported hate crimes in the UK.

However, it's just a little too easy to look at Brexit or Donald Trump and conclude that the lower orders have become political delinquents who can't be trusted to vote in the right way. Many working-class voters didn't vote for Hillary Clinton or Remain, certainly, but that isn't the same as being misogynist, xenophobic or hostile to gays. They often have very good reasons for not re-electing elite politicians who have done little for them in office.

The white working class have been the real losers over the past 30 years as secure well-paid manufacturing jobs have disappeared and secure working-class communities have been devastated. It's hardly surprising if they regard with suspicion politicians whose equality agenda seems to be about gender balance in the boardrooms. The wealth and income gap between rich women and poor women is growing faster than ever, even as the gap between male and female earnings is closing.

And all working-class voters aren't the same. A similar economic and social hurricane hit Scotland in the 1980s. Just as in Ohio or Sunderland, deindustrialisation left behind sink estates with shattered populations dependent on unemployment and disability allowances. Scotland's appalling health statistics are the most obvious legacy of the jobs holocaust. But this hasn't ignited any politics of the far right in Scotland – which is a puzzle for some.

It's not as if Scots are immune to the politics of prejudice. Scotland used to be profoundly homophobic. It is only 16 years since the “Keep the Clause” campaign to outlaw the "promotion" of homosexuality in schools divided Scotland almost as deeply as the independence referendum did in 2014. Surveys in the early years of devolution indicated that a substantial minority of Scots believed there was nothing wrong in being prejudiced against other races or religions. There were numerous accounts in the press of anti-English hate crimes.

But times have changed. On most available evidence, prejudice and homophobia have declined sharply in the past decade or so in all classes. Polls conducted by the Scottish Social Attitudes Survey show a remarkable turnaround in attitudes, for example, towards same-sex marriage, which was legalised in Scotland in 2014. The vast majority of Scots now believe that "everything should be done to combat racism and prejudice against sexual and ethnic minorities".

So, is there something special about Scottish working-class people that they are immune to the blandishments of right-wing populists like Farage and Trump? Or could it be that the hate is just lurking under the surface, waiting to be ignited by the first unscrupulous politician who gets a hearing for alt-right prejudice? Some Twitter-followers of JK Rowling insist that this has already happened and that the racially prejudiced "death-eaters" are alive and well in the Scottish National Party.

But whatever you think of Nicola Sturgeon, she could not conceivably be compared to Donald Trump, Nigel Farage or Marine Le Pen, and neither could the SNP, which has replaced Labour as the party of the Scottish working class. The First Minister would no more accept bigotry in her party than she would a membership application from the President elect. And it’s not that Scottish voters are immune to prejudice – rather, they have not yet given up on politics. Scottish working-class people registered and voted in unprecedented numbers in the independence referendum in 2014. Many believe a just society – that "better nation” – is possible and achievable by democratic means. This may be naïve, but it is what keeps a country together.

Scotland is also fortunate in having a form of relatively benign identity politics in the shape of Scottish nationalism. Patriotism isn't necessarily a bad thing provided it is attached to higher ideals than narrow self-interest. Small countries have to have modest ambitions and no-one talks of making Scotland Great Again.

Scots voted overwhelmingly to remain in the EU. Scotland also seems to have generated a love of country that doesn't involve overt displays of racial or ethnic superiority. Like the Tartan Army, many Scots have a keen awareness of their own limitations and take pride in their unglamorous proletarian origins. That's after all what “Jock Tamson’s Bairns” really means.

Consequently, the political parties in Scotland are all pretty much on the same political page. Labour, SNP, LibDems, Greens and even many Tories are broadly internationalist, support EU membership and are positive about the contribution made by immigrants. They are committed to an active, interventionist state, social housing, economic equality, comprehensive education, a state-provided national health service, as well as a host of things which are rarely discussed because there is no dispute about them such as respect for the rights of ethnic minorities and LGBT people.

The lesson from Scotland is surely that, with enlightened political leadership, it is not inevitable that economic grievance should express itself as working-class revolt against social liberalism. Yet, there has been much agonising recently in the wake of Brexit about identity politics and how the left has been too concerned with minority groups and not enough with the attitudes of the “real" working class. But this is a false dichotomy. Political leaders can channel discontent in a progressive direction.

Certainly, working-class voters will desert political parties of the left if they believe they don't promote their economic interests. They have a healthy disrespect for narrow-minded political correctness, too. The left needs to learn to speak in a language everyone can understand, be less censorious and avoid a discourse that suggests minority groups are morally superior.

The left also needs to understand that patriotism can be a progressive virtue as well as a reactionary vice. Many people love their country much as they love their families, and that needn't be a bad thing. In fact, if it is founded on civic values of internationalism and social justice, nationalism, like democracy itself, can be a political unifier. We all know that there’s nothing special about being Scottish and, in troubled times, that self-knowledge may be Scotland’s greatest asset.