Recently observed anomalous properties of ionic-liquid-based nanoporous supercapacitors [C. Largot et al., J. Am. Chem. Soc., 2008, 130, 2730-2731] have attracted much attention. Here we present Monte Carlo simulations of a model ionic liquid in slit-like metallic nanopores. We show that exponential screening of the electrostatic interactions of ions inside a pore, as well as the image-charge attraction of ions to the pore surface, lead to the 'anomalous' increase of the capacitance with decreasing the pore width. The simulation results are in good agreement with the experimental data. The capacitance as a function of voltage is almost constant for low voltages and vanishes above a certain threshold voltage. For very narrow pores, these two regions are separated by a peak. With increase of the pore size the peak turns into a bump and disappears for wide pores. This effect, related to a specific character of the voltage-induced filling of nanopores with counterions at high densities, is yet to be verified experimentally.