Three molecularly imprinted polymers (MIPs) have been synthesized in order to bind efficiently glyphosate (GLY) in natural waters (mineral and underground). Since the target analyte is polar and hydrophilic, electrostatic interactions and hydrogen bonds have been favored with two templates (phenylphosphonic acid and diethyl(α-aminobenzyl)-phosphonic acid) and two functional monomers (1-allyl-2-thiourea and methacrylic acid). MIPs have been assessed by comparison of the recoveries obtained with MIP and NIP (non imprinted polymer) by solid-phase extraction (SPE). The selectivity of MIP versus NIP was satisfactory for the three imprinted polymers with a very straightforward protocol: conditioning of 250 mg of MIP or NIP packed in 3-mL polypropylene cartridges with 3 mL Milli-Q water, loading of Milli-Q water (15 mL) spiked with 5 mg L(-1) of GLY and its metabolite, aminomethylphosphonic acid (AMPA) and elution by 3 mL NH4OH (10mM) or 3 mL HCl (100mM). SPE fractions were directly analyzed by capillary electrophoresis (CE). Thus, the recoveries of both analytes were greater than 80% for all MIPs and less than 25% for most NIPs. Moreover, the MIP prepared with 1-allyl-2-thiourea as functional monomer and phenylphosphonic acid as template displayed a capacity of 0.033 μmol/mg for GLY. However, the substitution of Milli-Q water by mineral water caused the decrease of MIP recoveries, for that, a pretreatment of the sample by ionic exchange resins was set up and succeeded in improving recoveries (about 50% for GLY and 25% for AMPA). Then, groundwaters were spiked with low concentrations of GLY and AMPA (0.5 μgL(-1)) and directly percolated through MIP cartridges. The extractions were carried out by triplicate and the elution fractions were analyzed by UPLC-MS/MS. The results showed no retention of AMPA but a total retention of GLY by MIP.