We prove that the space K(X) of compact operators on a Banach space X
is an M-ideal in the space L(X) of bounded operators if and only if X
has the metric compact approximation property (MCAP), and K(Y) is an M
-ideal in L(Y) for all separable subspaces Y of X having the MCAP. It
follows that the Kalton-Werner theorem characterizing M-ideals of comp
act operators on separable Banach spaces is also valid for non-separab
le spaces: for a Banach space X, K(X) is an M-ideal in L(X) if and onl
y if X has the MCAP, contains no subspace isomorphic to l(1), and has
property (M). It also follows that K(Z, X) is an M-ideal in L(Z, X) fo
r all Banach spaces Z if and only if X has the MCAP, and K(l(1),X) is
an M-ideal in L(l(1),X).