In this paper we study the stability of the HD 12661 planetary system in the framework of the N- body problem. Using the initial conditions found and announced by the California & Carnegie Planet Search Team, (http://exoplanets.org/almanacframe.html), we estimate the dynamical limits on orbital parameters that provide sta- ble (quasi-periodic) motions of the system. We investigate the orbital stability by combining the MEGNO indicator analysis with short-term integrations of the orbital dynamics. The MEGNO technique, invented by Cincotta & Simo (2000), makes it possible to distinguish efficiently between chaotic and regular dynamics of a conservative dynamical system. The orbital evo- lution, derived simultaneously with MEGNO, helps to identify sources of instability. The nominal initial condition leads to a chaotic solution, with a Lyapunov time � 1300 yr. In spite of this, the system motion seems to be bounded. This was examined directly, by long-term, 1 Gyr integrations. During this time, the eccentricities vary in the range (0.1, 0.4). The system is locked in apsidal resonance with the critical argument librating about 180 ◦ , with a full amplitude varying typically between 40 ◦ and 180 ◦ . Using MEGNO, we found that the HD 12661 system evolves on a border of the 11:2 mean motion resonance. This reso- nance is stable and results in a quasi-periodic evolution of the system. From the viewpoint of global dynamics, the crucial factor for system stability is the presence of the apsidal resonance. We detected this resonance in a wide neighborhood of the initial condition in the space of orbital parameters of the system, and in wide ranges of relative inclination and masses of the planets. The center of libration can be 180 ◦ (as in the nominal system) or 0 ◦ . The regime depends on the initial values of the apsidal longitudes. Statistically, the system prefers almost exclusively one of these two resonance regimes. The HD 12661 system gives a very evident example of the dynamical role of secular resonances, and their influence on the stability of exosystems containing Jupiter-like planets. Data derived by numerical experiments are compared with the results of Laplace-Lagrange secular theory. The analytical theory gives a crude approximation of the secular dynamics, because the eccentricities and masses of the planets are large, and the nominal system is near the 11:2 mean motion resonance.