"We are simply doing what we have to do following the tragic event of last week to look after our workers while ensuring our operation in Afghanistan can continue."
Aleem Siddique, a UN spokesman, said the move will affect 600 of the world body's roughly 1,100 international staff.
"We will be looking as a temporary measure to relocate some staff within the country and some staff outside of the country, while we can secure accommodation, where proper security measures can be provided for staff.
"We estimate that somewhere in the region of about 12 per cent of our staff would be affected across Afghanistan.
Speaking to Al Jazeera, Siddique said: "Let's be clear, the main priority is to ensure that UN programmes and activities continue in this country.
"We have been here for over than half a century and we have no intention of leaving any time soon."
Al Jazeera's James Bays, reporting from Kabul, said out of the 600 who will be relocated, the majority will be leaving the country.
"I'm also being told the UN is going to set up a new operation in Dubai, so it may well be that not all of these people are going to return to Afghanistan," he said.
"It looks like some of the work currently done in the Afghan capital may well be done outside the country in the future."
News of the UN withdrawal followed an unannounced visit by Ban to the Afghan capital where he urged Hamid Karzai, the Afghan president, to beef up security for UN staff working in the country.
The October 28 suicide attack, which left eight UN employees dead, targeted the Bekhtar guest house in central Kabul in an area close to several government ministries.
Three Taliban attackers and four Afghans were killed during a fierce gun battle that broke out after the raid.
In a statement afterwards, the Taliban said it had attacked the UN because of its involvement in organising Afghanistan's presidential elections, the second round of which has since been called off.
The UN announced on Wednesday it was taking additional steps to reduce risks to its national and international staff in Afghanistan in light of the attack and "ongoing threats".
A UN statement said the new measures would involve short-term relocations for some staff while additional security was put in place.