It has been a bad year for London, but the next few years might be even worse. A dangerous cocktail of Brexit turbulence, depopulation, housing bubbles and security woes may spoil the party. Given the capital contributes 30% of the UK’s tax revenue, Britons on either side of the M25 should be concerned.

Five years on from the glorious London Olympics, the city’s place in the world looks uncertain. Irrespective of whether Brexit ultimately proves to be a good or bad decision, it is certainly a short term shock. Registrations for national insurance numbers by foreign workers have fallen by 15% in the past year and EU student applications for London’s universities are down. Job growth in the metropolis has slowed for the first time since 2015 and now lags behind the rest of the UK.

Additionally, more people are leaving London than arriving. This applies to every age category except for those in their twenties. Net migration out of the city stands at 93,000, the equivalent of the entire population of Hastings every year.

Decisions to leave are driven by an overheating London housing market. The average cost to buy a house in London last year hit fourteen times the average earnings. Property owners who moved out of the city on average saved £250,000, comparing the price of property in London versus their new homes.

Now, the market is shaky. For the first time in seven years, more properties are being withdrawn from the residential market than sold, and house prices in London rose by just 2.6% in the year to June compared with a national increase of 4.6%. A correction might help the market to adjust, but a full asset bubble burst could destabilise both businesses and households: Savills predicts the number of new builds will half in the next five years due to market headwinds.

At the same time, security risks feel more present than at any time in a generation. A string of horrendous terrorist atrocities, a spate of acid attacks and a general rise in violent crime is making Londoners and tourists alike wary.

So the clouds gather.

However, just as London’s inexorable rise was never inevitable, nor is its fall now. The city has formidable strengths: a vibrant array of business sectors, a popular mayor, a pool of highly-skilled labour and some of the best universities in the world.

To succeed, London must harness all of these strengths. Sadiq Khan’s elevation as the first Muslim mayor of a big western city was reported widely in the United States, Europe and beyond; he should use this cache to spread his ‘London is Open’ campaign and ensure tourism, high-skilled immigration and inward investment continue post-Brexit.

Further, government at all levels – from councils to Downing Street – should bring London’s business leaders to the table. The city’s economy can diversify beyond finance and professional services by bolstering the creative, media, and tech industries. CEOs and entrepreneurs should have opportunities to voice concerns on skills, rates and regulation. In return, those businesses should work hand-in-hand with London’s colleges and universities to offer more apprenticeships, technical training and entry jobs.

In Whitehall, the impulse will be to centralise, but the right response is the opposite. The Greater London Authority has far less autonomy to determine tax rates and retain revenues than sister cities like New York, Paris and Tokyo. The Treasury should give meaning to its vaunted ‘devolution revolution’ by giving London greater levying and spending powers which it can then invest in new housing and transport, partnered with the private sector.

Perhaps most importantly, Londoners must stick together. The Grenfell Tower tragedy has tested frayed relationships between different parts of society. If the city is to remain the world’s melting pot, it is crucial that the child in Croydon feels just as much right to be a Londoner as the millionaire in Chelsea.

In the 1960s and 1970s, London experienced economic, demographic and cultural decline. In the 1980s and 1990s it rose from the ashes and, by the summer 2012, was the centre of the world’s attention. Perhaps it is time for London to be reborn again.

Benjamin Clayton is a Fellow at Harvard’s Kennedy School of Government and was previously Chief of Staff at the British government’s National Infrastructure Commission.