Higher-order Sugawara operators for affine Lie algebras