Around 600 UK troops are to be sent to Afghanistan to assist British nationals to leave, the government has announced.
It comes as the Taliban has seized the cities of Ghazni and Herat – taking control of 11 provincial capitals in less than a week.
Military personnel will provide protection and help relocate UK nationals, Afghan staff and interpreters.
Last week the Foreign Office advised all British nationals to leave.
It is estimated that around 4,000 British citizens are still in the country.
Defence Secretary Ben Wallace said the security of British nationals, military personnel and former Afghan staff was the government’s first priority and that it “must do everything we can to ensure their safety”.
Mr Wallace said deployment of troops, who will be arriving in the coming days, was a “pre-planned phase” and was to “enable the next step of leaving”.
But the Ministry of Defence said the additional deployment was “in light of the increasing violence and rapidly deteriorating security environment in the country”.
The UK’s ambassador to Afghanistan, Sir Laurie Bristow, will continue to lead a small team in Afghanistan which will relocate within Kabul to a more secure location, the MoD said.
As well as British nationals, the embassy will help the UK’s Afghan Relocations and Assistance Policy (ARAP), which has already supported more than 3,100 former Afghan staff and their families to move to the UK, including 1,800 in the last few weeks, the MoD said.
The US has also said it is sending 3,000 military troops to the airport in Kabul to help evacuate a “significant” amount of embassy staff on special flights.
By Paul Adams, BBC diplomatic correspondent
It was always likely, this close to the end of the Nato mission to Afghanistan, that events would appear to accelerate. We are, after all, getting out.
But as they made their careful arrangements, planners did not necessarily anticipate the speed of the Taliban’s advance, or the weakness of an Afghan military the US and its allies spent almost two decades building up.
What they wanted was an orderly withdrawal, with the Afghan government able to hold its own.
What we’re facing, instead, is something altogether more chaotic.
Perverse though it might sound, sending troops in to get people out was always going to be part of the plan.
So too was the relocation of the British embassy to a more secure (and as yet undisclosed) location.
But the withdrawal of an unspecified number of embassy personnel, with the Americans making a similar move, is clearly being driven by events on the ground.
With US officials warning that the Afghan government could fall in as little as 30 days (a worst case scenario, it has to be noted), these feel like the crisis plans everyone hoped they wouldn’t have to use.
Thousands of civilians have been displaced and fled to Kabul to try to escape the fighting.
And the UN has estimated more than 1,000 civilians have been killed in Afghanistan in the past month.
Makeshift camps have been established on the outskirts of the capital, while many others have reportedly been sleeping on the streets or in abandoned warehouses. The BBC speaks to two high profile figures in the Taliban chain of command who have very different messages
Labour’s shadow defence secretary John Healey said the MoD had his party’s full backing on sending troops to help the evacuation.
“We share widespread dismay that the security situation in Afghanistan is deteriorating so much faster than forecast,” he said, adding that while the UK’s forces were withdrawing “we cannot walk away from the people of Afghanistan”.
In a heartfelt series of posts, Conservative chair of the Commons Foreign Select Committee Tom Tugendhat, who served in Afghanistan, tweeted that the decision to withdraw was “like a rug pulled from under the feet of our partners”.
“That’s why I’m angry. It’s wasteful and unnecessary. And why it’s personal? Because I’ve seen what it costs and what sacrifices are being thrown away,” he wrote.
Tory colleague Tobias Ellwood, who chairs the Defence Select Committee and also served in the British Army, told the BBC we “should really be reconsidering what’s going on” in Afghanistan. He warned the withdrawal of troops was leaving the country to a “massive humanitarian disaster” and said that it would allow terrorism to “raise its ugly head again”.
The Taliban has moved with speed, seizing new territories and cities almost daily, as the US and other foreign troops withdraw from Afghanistan after 20 years of military operations.
They now control around a third of the country’s regional cities and most of northern Afghanistan.