This paper presents new sufficient conditions for exponential stability of switched linear systems under arbitrary switching, which involve the commutators (Lie brackets) among the given matrices generating the switched system. The main novel feature of these stability criteria is that, unlike their earlier counterparts, they are robust with respect to small perturbations of the system parameters. Two distinct approaches are investigated. For discrete-time switched linear systems, we formulate a stability condition in terms of an explicit upper bound on the norms of the Lie brackets. For continuous-time switched linear systems, we develop two stability criteria which capture proximity of the associated matrix Lie algebra to a solvable or a .solvable plus compact. Lie algebra, respectively.