Officials say a militant attack on a security post in eastern Afghanistan has killed four policemen.

The Khost provincial government says in a statement on Thursday that two members of the national police and two border police died in the attack the previous night in Ali Shir district.

It says three militants were killed in the battle and one was captured.

The deputy police chief for Khost, Yaquob Khan, says the battle for the post lasted two hours. He says the attackers were from the Haqqani network, a Pakistan-based militant group aligned with both the Taliban and al-Qaeda.

The Taliban and their allies have intensified attacks on Afghan forces nationwide, seeking to undermine the government in the run-up to the withdrawal of most international troops by the end of the year.