“As a local mum, there’s no way you can get on a housing register anymore,” says Fay. It’s a familiar story of what happens when government puts markets ahead of people’s needs.

Mould was growing on the walls of Fay’s ageing home; but she was told her son’s disability was not extreme enough to be classified a priority. The council housing in the east London borough of Barking and Dagenham simply isn’t there: with the failure to replace stock sold under right-to-buy, what remains is reserved for those most in need. And Fay does not qualify.

Britain’s housing crisis has all sorts of consequences: it damages the health and education prospects of young people; it puts strains on families; and it inflames tensions by making locals feel they are in competition with one another. These tensions were part of what led to many communities voting to leave the European Union: in Barking and Dagenham 62% backed Brexit.

Locals are at pains to stress the community solidarity, the warmth, the liberty to knock on a neighbour’s door for help. But pride at Ford’s Dagenham factory – in its heyday it employed 40,000 locals – is accompanied by a sense of loss at its decline.

There are bright spots – the excitement about new film studios – but zero-hour contracts and low-paid service sector jobs are the reality for many youngsters. A housing crisis and a demographic shift – the white British population fell from 80% to 50% between 2001 and 2011 – led to resentment that was exploited. The BNP won 12 council seats in 2006.

Thankfully, the far right was soon voted out and every council seat went to Labour at the last elections. But the borough is far from united. The government’s failure on housing is catastrophic: apart from the years when the Luftwaffe pounded Britain, you’d have to revert to the 1920s for a time when so few homes were being built. In a pokey office near Dagenham East tube station, councillor Margaret Mullane tells me that housing is the top issue in local surgeries, and the number one issue on the doorstep. As home ownership plummets to the lowest level in three decades, a generation is being driven into an unregulated and often unaffordable private rented sector. No wonder the borough voted for Brexit: force people to feel they are competing for scarce resources, and some will start to question if the competition is legitimate.

As I drive around the borough with Darren Rodwell – who grew up on a local estate and now leads the council – he speaks passionately about efforts to resist government policy. The government, he says, has looked at the housing crisis and found innovative ways of making it even worse. Four of 10 council flats sold under right-to-buy are now rented out more expensively by private landlords, sometimes the children of parents who benefited from the policy.

Darren Rodwell, the council leader, says the government has looked at the housing crisis and found innovative ways of making it even worse. Photograph: Sean Smith/The Guardian

The government is extending right-to-buy to housing associations, and abolishing lifetime security for council tenants. Unwilling to build houses with no security of tenure, the council has found an ingenious way around it: setting up its own private company, Reside, which offers secure tenancies of up to five years. A range of homes are on offer: rents for those on minimum wage, and homes at 65% and 80% of market rates.

There are criticisms, even from the local party. Phil Waker, a councillor who used to have the housing portfolio, doesn’t believe the council is building enough homes for social rents. Indeed, the 30-year-old Labour activist Andrew Achilleos lives in a pilot offering rents at 65% of the market rate, and knows residents who have had to leave because they couldn’t afford it. Yet it’s difficult not to sympathise with a council that has limited options with a government determined to shred social housing.

So housing fuels tensions, but one should not downplay the impact of prejudice. I meet an elderly ex-Ford worker on his way to pay his rent at the council office. A Ukip supporter – he didn’t vote before they came along – he peddles out-and-out myths.

“If you’re the same colour as me you can’t get a flat or anything like that. If you’re one of the other colour you’re alright. It’s all wrong isn’t it!” I tell him I’ve met many white local council tenants, and ask if he accepts that migrants are more likely to be housed by private landlords. He’s having none of it: “You go down to Barking and spot the white man!” I tell him that I have, and he segues into “bloody Romanians”, all “robbing and pickpocketing”.

It's the government’s ideological failure to regulate the private rented sector, not migrants, that should be our focus

I meet Litu Cristina Riamona, a Romanian. She speaks five languages and bitterly resents the prejudice she’s suffered since the referendum result, from those who would cast her as part of the housing problem. Tony, a 20-year-old student, was a local Vote Leave coordinator; he let his Ukip membership lapse after the referendum. He stresses that racists represent a minority of leave voters; but during the campaign, he tells me, he repeatedly had to challenge people “on my side who would say horrible things”.

In such a febrile atmosphere, the job is to cool tempers and challenge myths. Rodwell and I talk to 80-year-old Patricia Rogers. She doesn’t object to migrants – her Bulgarian and Algerian neighbours are “as good as gold” – but feels they’re being given houses ahead of locals. In fact, Rodwell explains, they’re highly unlikely to be entitled to a council flat: they’ll either have bought homes, or be living in private buy-to-let flats. An unregulated private rented market is indeed lucrative for landlords: the council recently raided a three-bedroom property housing 35 migrants. It is the government’s ideological failure to regulate the private rented sector – not migrants seeking a better life – that should be our focus.

What’s manifest here are the consequences of one of the world’s wealthiest nations failing to meet one of the most basic rights of its citizens. What happened last June was a product of that. Theresa May said the Brexit result was about “changing the way this country works”. Were she to end the assault on council housing, that would be a start.