The GALIC code is a publicly available program that implements a new iterative method for the construction of N-body galaxy models in collisionless equilibrium. The method uses elements of Schwarzschild’s technique and of the made-to-measure method, but is based on a different principle. Starting with some initial assignment of particle velocities, the difference of the time-averaged density response produced by the particle orbits with respect to the initial density configuration is characterized through a merit function, and a stationary solution of the collisionless Boltzmann equation is found by minimizing this merit function directly by iteratively adjusting the initial velocities. Because the distribution function is in general not unique for a given density structure, the merit function is augmented with additional constraints that single out a desired target solution. The velocity adjustment is carried out with a stochastic process in which new velocities are randomly drawn from an approximate solution of the distribution function, but are kept only when they improve the fit. The method converges rapidly and is flexible enough to allow the construction of solutions with third integrals of motion, including disc galaxies in which radial and vertical dispersions are different.