Afghan forces face intense Taliban test as foreign troops leave