Afghan forces formally take over security of country