A new three-component condensation of β-ketonitriles, 4-fluorobenzaldehyde, and secondary cyclic amines was developed. A possible reaction mechanism has been proposed including Knoevenagel condensation followed by aromatic nucleophilic substitution. It was found that in the case of 3-oxopropanenitrile bearing the 6-amino-1,3-dimethyluracil moiety, the reaction is not accompanied by fluorine substitution in the Knoevenagel adduct, and the Michael addition of a secondary amine occurs followed by oxidation.