Context. A variety of laboratory ice spectra simulating different chemical environments, ice morphologies, and thermal and energetic processing are needed in order to provide an accurate interpretation of the infrared spectra of protostars. To decipher the combination of laboratory data that best fits the observations, an automated, statistics-based computational approach is necessary. Aims. We aim to introduce a new approach, based on evolutionary algorithms, to searching for molecules in ice mantles via spectral decomposition of infrared observational data with laboratory ice spectra. Methods. We introduce a publicly available and open-source fitting tool called ENIIGMA (dEcompositioN of Infrared Ice features using Genetic Modelling Algorithms). The tool has dedicated Python functions to carry out continuum determination of the protostellar spectra, silicate extraction, spectral decomposition, and statistical analysis to calculate confidence intervals and quantify degeneracy. We conducted fully blind and non-blind tests with known ice samples and constructed mixtures in order to asses the code. Additionally, we performed a complete analysis of the Elias 29 spectrum and compared our findings with previous results from the literature.Results. The ENIIGMA fitting tool can identify the correct ice samples and their fractions in all checks with known samples tested in this paper. In the cases where Gaussian noise was added to the experimental data, more robust genetic operators and more iterations became necessary. Concerning the Elias 29 spectrum, the broad spectral range between 2.5 and 20 µm was successfully decomposed after continuum determination and silicate extraction. This analysis allowed the identification of different molecules in the ice mantle, including a tentative detection of CH 3 CH 2 OH. Conclusions. The ENIIGMA is a toolbox for spectroscopy analysis of infrared spectra that is well-timed with the launch of the James Webb Space Telescope. Additionally, it allows different chemical environments and irradiation fields to be explored, allowing the user to correctly interpret astronomical observations.