  We present a general counting result for the unstable eigenvalues of linear
operators of the form $JL$ in which $J$ and $L$ are skew- and self-adjoint
operators, respectively. Assuming that there exists a self-adjoint operator $K$
such that the operators $JL$ and $JK$ commute, we prove that the number of
unstable eigenvalues of $JL$ is bounded by the number of nonpositive
eigenvalues of~$K$. As an application, we discuss the transverse stability of
one-dimensional periodic traveling waves in the classical KP-II
(Kadomtsev--Petviashvili) equation. We show that these one-dimensional periodic
waves are transversely spectrally stable with respect to general
two-dimensional bounded perturbations, including periodic and localized
perturbations in either the longitudinal or the transverse direction, and that
they are transversely linearly stable with respect to doubly periodic
perturbations.
