Afghan official says militant attack kills 8 policemen