The dynamics of the quasi-monochromatic surface gravitational waves in a finite-depth fluid is studied for the case where the product of the wavenumber by the depth of the fluid is close to the critical value kcrh ≈ 1.363. Within the framework of the Hamiltonian formalism, the general nonlinear Schrödinger equation is derived. In contrast to the classical nonlinear Schrödinger equation, this equation involves the gradient terms to the four-wave interaction, as well as the six-wave interaction. This equation is used to analyze the modulation instability of the monochromatic waves, as well as the bifurcations of the soliton solutions and their stability. It is shown that the solitons are stable and unstable to finite perturbations for focusing and defocusing nonlinearities, respectively.