Twofold effect of Alfvén waves on the transverse gravitational instability