German car giant BMW has announced plans to invest hundreds of millions of pounds to prepare its Mini factory near Oxford to build a new generation of electric cars.
Production of two new electric Mini models is due to begin at the plant in Cowley in 2026.
The move is expected to safeguard the future of the facility, as well as that of another factory in Swindon.
More than 4,000 people currently work across the two sites.
BMW will spend £600m on updating the Cowley plant, developing the production lines, extending its body shop and building a new area for installing batteries.
It also plans to build additional logistics facilities at Cowley and at the Swindon factory - which makes body panels for new vehicles.
This will allow two next-generation electric designs, the Mini Cooper and the larger Mini Aceman, to be built at Cowley alongside conventional cars.
A third electric model, the Countryman, will be made in Germany.
The UK investment will be backed by funding from the government - understood to be worth £75m.
Mike Hawes, chief executive of UK industry body the Society of Motor Manufacturers and Traders, called the announcement a "vote of confidence" in the country's automotive manufacturing industry.
"Not only does it secure the long-term future of the home of one of the world's most iconic brands, it also demonstrates once again our capabilities in electric vehicle production," he said.
"Investments such as this improve productivity and help deliver jobs, growth and economic benefits for the country."
With the Mini brand expected to go fully electric by 2030, BMW's decision is vital to the future of the two UK factories.
The first electric Mini was launched at the Cowley plant in 2019.
But last year, the company confirmed production of most of its electric cars would move to China, where the new models have been developed in partnership with Great Wall Motor.
At the time, BMW suggested that building both conventionally-fuelled and electric cars in the same factory was inefficient.
Now, that plan has clearly changed.
Production of the new models will begin next year at Great Wall's factory in Zhangjiagang - with Cowley now expected to start building them as well in 2026.
Prime Minister Rishi Sunak said BMW's investment was "another shining example of how the UK is the best place to build cars of the future".
Asked about speculation that the amount of government funding for BMW in relation to its Oxford plant is around £75m, Business Secretary Kemi Badenoch told reporters: "I won't comment on the figure because that creates difficulties in future negotiations.
"What I will say is that we do provide some subsidy, very light subsidy, in the auto industry because it faces so much difficulty, and some of that is regulatory.
"So if we're asking manufacturers to transition to net zero, that creates additional costs which make it a little bit harder so we do have to factor that in."
This is the latest in a series of government-backed investments designed to promote the development of electric vehicles in Britain, ahead of a ban on the sale of new petrol and diesel-powered cars due to take effect in 2035.
In July, Jaguar Land Rover's owner, the Indian group Tata, said it would build a giant "gigafactory" to produce batteries in Somerset, a project expected to benefit from hundreds of millions of pounds in taxpayer support.
Stellantis has just begun production of electric vans at its Ellesmere Port factory in Cheshire; Nissan is expanding output of EVs at its Sunderland factory, while its partner Envision AESC is building a gigafactory close by.
Meanwhile, Ford is investing heavily in its Halewood plant, preparing it to build electric motors.
But there have also been setbacks for the industry in recent years, including the closure of Ford's engine plant in Bridgend in 2020 and Honda's Swindon factory in 2021.
In January, Britishvolt, which had been planning to build a battery factory near Blyth, collapsed into administration. The future of the site remains uncertain.
David Bailey, professor of business economics at Birmingham Business School, told the BBC the BMW announcement was "great news, but remember the UK is playing catch-up".
"We've been lagging behind in EV production. We're going to need a lot more if we are going to preserve a mass car industry in the UK."
What is not yet known is where the batteries for the cars to be built at Cowley will come from.
That could yet become a critical issue. From next year, new rules will effectively ensure that cars with batteries made outside either the UK or the EU will face steep tariffs when shipped across the Channel.
BMW is one of a number of businesses lobbying in the EU and the UK for those measures to be watered down or delayed.
"The Brexit trade rules mean that if you don't have enough local content in cars, there will be a 10% tariff on trade between the UK and the EU," Prof Bailey said. "Now clearly that's a big hit for the likes of Stellantis and BMW. That needs to be revised quickly."
He added that there was a lot of pressure "on both sides of the Channel" to change the trade rules. "I think the European Commission will move at some point, but probably too late."
Sign up for our morning newsletter and get BBC News in your inbox.