Afghan forces took control of security across the country on Tuesday, marking a major milestone as U.S.-led combat troops prepare to withdraw after 12 years of fighting the Taliban.

Speaking at a military academy outside Kabul, President Hamid Karzai said the police and army were ready to take on insurgents, but a bomb in the city underlined persistent instability.

Three civilians were killed in the attack, which targeted a prominent lawmaker as his convoy travelled to parliament just before the handover ceremony began.

"Our security and defence forces will now be in the lead," Karzai told Afghan and NATO officials at the event, the timing and location of which had been kept secret due to fears of a militant attack.

"From here, all security responsibility and all security leadership will be taken by our brave forces," he said.

"When people see security has been transferred to Afghans, they support the army and police more than before."

Doubts remain over the ability of Afghan forces to thwart the Taliban, and the NATO military coalition will retain an important function in logistics and air support as well as in combat emergencies.