The Fermi Large Area Telescope (Fermi-LAT) has recently revealed a large population of gamma-ray emitting millisecond pulsars (MSPs) in our Galaxy. We aim to infer the properties of the Galactic population of gamma-ray emitting MSPs from the samples detected by the Fermi-LAT. We developed a Monte Carlo model to predict the spatial and gamma-ray luminosity distribution of the Galactic MSP population. Based on the estimated detection sensitivity of Fermi-LAT, we split the model population into detectable and undetectable samples of MSPs. Using a maximum likelihood method, we compared the detectable sample to a set of 36 MSPs detected by Fermi-LAT, and we derived the parameters of the spatial distribution and the total number of gamma-ray emitting MSPs in the Galaxy. The corresponding undetectable sample provided us with an estimate for the expected diffuse emission from unresolved MSPs in the Milky Way. We also applied our method to an extended sample of 66 MSPs that combines firmly detected MSPs and gamma-ray sources that show characteristics reminiscent of MSPs. For the first time our analysis provides gamma-ray based constraints on the Galactic population of MSPs. The radial scale length and vertical scale height of the population is consistent with estimates based on radio data. Our analysis suggests that MSPs do not provide any significant contribution to the isotropic diffuse gamma-ray background emission.