This work presents the first continuum shell-model study of weakly bound neutron-rich nuclei involving multiconfiguration mixing. For the single-particle basis, the complex-energy Berggren ensemble representing the bound single-particle states, narrow resonances, and the nonresonant continuum background is taken. Our shell-model Hamiltonian consists of a one-body finite potential and a zero-range residual two-body interaction. It is demonstrated that the residual interaction coupling to the particle continuum is important; in some cases, it can give rise to the binding of a nucleus.