An official said that two gunmen who tried to enter the compound were shot dead. (FILE PHOTO)

The Afghan Taliban killed at least 12 security force members in a car bomb attack on a military base in the central province of Maidan Wardak on Monday, officials said.

Two gunmen who tried to enter the compound were shot dead, Mohebullah Sharifzai, spokesman for the Maidan Wardak provincial governor, said.

"A (second) car, packed with explosives, was also discovered and defused," he added.

Mohammad Salem Asgharkhil, the province's health director, said 28 wounded members of the security forces had been taken to hospital.

"Looking at the damage, the number of casualties may rise and our health team is still searching for victims," he told Reuters.

The Taliban claimed responsibility for the attack, which spokesman Zabihullah Mujahid said had killed or wounded dozens.

The insurgents have increased attacks in recent months in their effort to overthrow the Western-backed government and restore their version of hardline Islamic law, even as talks with the United States to try to end the 17-year war have gathered pace.

Strategically located along the route connecting Kabul to the south, Maidan Wardak is a staging ground for suicide bombings in the capital by insurgents who control nearby mountain villages.