Security to remain major threat ahead of Afghan elections