Ecological determinants of ecosystem stability