We present the results of a systematic study of the evolution of low-and intermediate-mass X-ray binaries (LMXBs and IMXBs). Using a standard Henyey-type stellar evolution code and a standard model for binary interactions, we have calculated 100 binary evolution sequences containing a neutron star and a normal-type companion star, where the initial mass of the secondary ranges from 0.6 to 7 M _ and the initial orbital period from D4 hr to D100 days. This range samples the entire range of parameters one is likely to encounter for LMXBs and IMXBs. The sequences show an enormous variety of evolutionary histories and outcomes, where di †erent mass transfer mechanisms dominate in di †erent phases. Very few sequences resemble the classical evolution of cataclysmic variables, where the evolution is driven by magnetic braking and gravitational radiation alone. Many systems experience a phase of mass transfer on a thermal timescale and may brieÑy become detached immediately after this phase (for the more massive secondaries). In agreement with previous results (Tauris & Savonije 1999), we Ðnd that all sequences with (sub)giant donors up to D2 are stable against dynamical mass transfer. Sequences M _ where the secondary has a radiative envelope are stable against dynamical mass transfer for initial masses up to D4 For higher initial masses, they experience a delayed dynamical instability after a M _ . stable phase of mass transfer lasting up to D106 yr. Systems where the initial orbital period is just below the bifurcation period of D18 hr evolve toward extremely short orbital periods (as short as D10 minutes). For a 1 secondary, the initial period range that leads to the formation of ultracompact M _ systems (with minimum periods less than D40 minutes) is 13È18 hr. Since systems that start mass transfer in this period range are naturally produced as a result of tidal capture, this may explain the large fraction of ultracompact LMXBs observed in globular clusters. The implications of this study for our understanding of the population of X-ray binaries and the formation of millisecond pulsars are also discussed.