(Adds quotes, details)
By Michael Georgy
KABUL, Dec 6 (Reuters) - The Taliban said on Thursday they carried out a suicide bombing that wounded Afghanistan's intelligence chief in Kabul, another sign that the government is struggling to improve security ahead of a NATO pullout in 2014.
Asadullah Khalid was wounded when the bomber struck at a guesthouse used by the National Directorate of Security (NDS) in a heavily guarded area of the capital. The intelligence agency said he had survived a "terrorist attack".
"Asadullah Khalid was the main target. A number of spies have been killed and wounded," said Taliban spokesman Zabihullah Mujahid in a statement.
There were no immediate comments from officials on whether there were other casualties.
The bombing highlights Afghanistan's instability as U.S.-led NATO troops prepare to withdraw by the end of 2014.
After more than 10 years of war against Western forces as well as Afghan troops, militants are capable of striking in the heart of the capital.
In a video message released by his office, President Hamid Karzai said:
"The head of the NDS is now undergoing surgery ... the chief of the hospital has told me he is in a good condition and now we hope he will recover and he will be sent for further treatment elsewhere."
Afghanistan's parliament approved the nomination of Khalid as the new head of the NDS in September, an appointment that alarmed human rights groups who have long accused the agency of torturing detainees, allegations it denies.
"We will see more similar attacks in order to further increase uncertainty about 2014. It's part of the psychological warfare by the Taliban," said Davood Moradian, a former presidential adviser and head of the Afghan Institute for Strategic Studies, a think-tank..
Moradian said Khalid was a powerful ally for Karzai since he had built up a formidable network of contacts among the Pashtun community in the south and east of the country, where the insurgency is strongest.
He said Khalid was renowned for his tough stance against the Taliban and his belief that the Afghan government needed to take a tough line with the insurgents in any negotiations.
Human rights groups have been troubled by allegations that Khalid, a close aide of Karzai, ran a torture prison while he was governor of Kandahar. He denies any wrongdoing.
Khalid built a formidable intelligence network to infiltrate the Taliban while serving in previous posts as governor of Kandahar and Ghazni provinces, both hotbeds of insurgency, said Michael Semple, an expert on the Taliban at the Carr Center for Human Rights Policy at Harvard.
"He had access to significant operational funds and used these to run agents deep inside the Taliban in Quetta," Semple said, referring to the city in southwest Pakistan where many of the Taliban's leaders are believed to be based.
"He also has a reputation for conducting black operations, bombings and assassinations, which is why the Taliban fear him," Semple added.
Khalid is seen as one of the most effective operators in Afghanistan's security hierarchy.
Diplomats saw Khalid as an instrumental figure in a systematic attempt to rig the 2009 presidential election in favour of Karzai, which sparked a protracted showdown with Washington before Karzai was eventually returned to power.
As one of the most influential members of Karzai's circle, Khalid was poised to play a critical role in the fraught process of political transition before the next elections in April, 2014, when Karzai is bound by the constitution to step down.
Attempts to draw the Taliban into formal peace talks have made little headway, piling pressure on Karzai's government to improve security before Western combat troops withdraw.
Reconciliation efforts were dealt a major blow last year when Afghanistan's chief peace negotiator, Burhanuddin Rabbani died at his Kabul home when an insurgent he was due to hold talks with detonated explosives concealed in a turban. (Additional reporting by Matthew Green in Islamabad; Editing by Jon Hemming)