The company had earlier said it chose a location near Berlin for a new design centre and plant to make batteries, powertrains and vehicles, offering a major boost to the German capital.

Berlin's minister in charge of economic affairs, Ramona Pop, said the move could create 6,000 to 7,000 jobs in production alone, with hundreds or even thousands more in areas such as design, software or research.

"Brexit (uncertainty) made it too risky to put a Gigafactory in the UK," Musk told industry website Auto Express.

No one from Tesla was immediately available to comment.

Britain's vote to leave the European Union has hurt foreign investment because the country's future trading relationship with the EU is still not clear, more than three years after the referendum.

Britain holds a parliamentary election in December in a bid to break the impasse. Conservative Prime Minister Boris Johnson has said high levels of inward investment would return once terms of the withdrawal agreement have been settled.

Major carmakers such as Nissan have said a disorderly departure from the bloc, where companies face tariffs after leaving the EU without a transition deal, would be unsustainable and jeopardise its entire business model.

Britain's business minister Andrea Leadsom said the government was aware that the uncertainty over Brexit is causing investment to be put hold and that is why the upcoming election is needed.

"We need a Conservative government to get Brexit done with a deal and end the uncertainty," she said.

But the opposition Liberal Democrats said the decision shows Johnson's "deluded plans are already costing the country vital investment and making us all poorer".

(This story refiles to add word in parentheses, paragraph 4)

(Writing by William Schomberg; Editing by Edmund Blair and Stephen Addison)