LONDON — Nissan will invest $1.4 billion to update its factory in northeast England to make electric versions of its two best-selling cars, a boost for the British government as it tries to revive the country’s ailing economy.

The Japanese automaker manufactures the gasoline or gas-hybrid Qashqai and smaller Juke crossover vehicles at the factory in Sunderland, which employs 6,000 workers.

Nissan Motor Co. said it’s investing up to $1.4 billion to produce electric successors to the two models.

The money also will enable “wider investment in infrastructure projects and the supply chain, including a new gigafactory” for EV batteries at the site, the government said in a separate news release.

The Qashqai is the U.K.’s second most popular vehicle this year, while the Juke is the seventh. Nissan also said it will make the next generation of its long-running Leaf electric car at the factory.

The company said in 2021 that it planned to build an electric vehicle at the factory, alongside batteries made next door by supplier AESC, owned by China’s Envision.

AESC already has two gigafactories in Sunderland, and Friday’s announcement adds a third.

The future of Nissan’s Sunderland had been in question before and after Britain’s 2016 vote to leave the European Union because companies like Nissan would face tariffs on exports to the EU.

The auto industry is bracing for 10% post-Brexit trade tariffs taking effect in January. They threaten to raise the cost of new EVs by punishing manufacturers in their respective markets for not sourcing enough of their components from either the EU or Britain.