LONDON — Prime Minister Boris Johnson on Thursday announced Britain's biggest boost in military spending since the end of the Cold War, as the country looks to head off threats from China and Russia and exert "global influence" as a power separate from the European Union.

Over the next four years, the British armed forces will receive an extra 16.5 billion pounds ($21 billion), helping to develop cyber- and space capabilities, create an artificial-intelligence agency and “restore Britain’s position as the foremost naval power in Europe,” Johnson said.

Britain — which has fought alongside the United States in places such as Syria, Iraq and Afghanistan — already had one of the largest military budgets in Europe, surpassing the NATO guideline of 2 percent of gross domestic product. This new budget would represent a 10 percent rise from previous spending plans, in what the government characterized as the largest increase in 30 years.

Britain will “end the era of retreat, transform our armed forces, bolster our global influence,” Johnson told Parliament via video link. He is self-quarantining at his Downing Street residence after contact with a coronavirus-positive lawmaker, though the prime minister had the virus in the spring and tested negative this week.

Defense analysts said the increase was higher than anticipated, especially given the battering the economy has taken from the pandemic.

Johnson told Parliament on Thursday that he made the decision “in the teeth of the pandemic” because “the defense of the realm and safety of the British people must come first.”

The world is “more perilous and more intensely competitive than at any time since the Cold War,” he said.

Britain is particularly concerned about cyberthreats, Chinese expansionism and potential conflict with Russia, which in 2018 poisoned a former double agent and his daughter in the English city of Salisbury.

But the spending increase also comes at a time when Britain’s position on the world stage is changing. The Brexit transition period is set to expire next month.

Malcolm Chalmers, deputy director general at RUSI, a London-based think tank, said one of the possible “drivers of this generous settlement has been the need to show that the U.K. has a unique value as a defense partner for our closest allies, the U.S. and our European neighbors.”

At the beginning of the new year, the government may be “anxious to repair any damage done by the Brexit process,” Chalmers said. “This sends a clear message that the U.K. will continue to be a major contributor and, on most measures, Europe’s strongest military power.”

Tim Bale, a professor of politics at Queen Mary University, said the government may have both Brexit and the incoming Biden administration in mind.

“It’s a combination of Britain wanting to show it can still make a splash in ways that will hopefully mesh well with the new president’s priorities,” Bale said. “It’s also a way of reminding Europe it’s still a big player when it comes to defense and although we are detaching ourselves from the E.U., we are not detaching ourselves from the defense of Europe.”

As part of the defense investment, the prime minister announced the creation of National Cyber Force, a partnership between intelligence and defense; Space Command, which will launch satellites; and a new agency dedicated to artificial intelligence.

Keir Starmer, leader of the opposition Labour Party, welcomed extra spending but questioned where the money will come from. In particular, he said he was concerned that the government would break its pledge to spend 0.7 percent of gross national income on foreign aid.

“How will this announcement be paid for? Such is the government’s handling of the pandemic, the U.K. has the sharpest economic downturn of any [Group of Seven] country,” Starmer said.

Andrew Mitchell, a former international development secretary, told Johnson he should “bear in mind the wise words of General [Jim] Mattis, the former American defense secretary, who told Donald Trump, and I quote, ‘The more you cut aid, the more I have to spend on ammunition.’ ”

Johnson responded by saying Britain will “continue to lead the world” on international aid.

The defense hike was welcomed by Washington.

Acting U.S. defense secretary Christopher C. Miller said the United States “applauds the announcement,” which he said would allow the British military to “continue to be one of the finest fighting forces in the world.”

“Their commitment to increased defense funding should be a message to all free nations that the most capable among us can — and must — do more to counter emerging threats to our shared freedoms and security,” he said.