A process for the preparation of soft and hard resins from an urea, formaldehyde and a CH-acidic aldehyde, by reacting an urea of formula (I) or (II). ##STR8## where R.sup.1 and R.sup.2 are hydrogen or identical or different alkyl of 1 to 18 carbon atoms, A is alkylene of 1 to 6 carbon atoms and X is oxygen or sulfur, with formaldehyde and a CH-acidic aldehyde of formula (III). ##STR9## where R.sup.3 and R.sup.4 are identical or different alkyl, aryl or alkylaryl, the urea, formaldehyde and CH-acidic aldehyde being employed in a molar ratio of from 1:2:2 to 1:4:4, at from 60.degree. to 150.degree. C., in the presence of an acid, wherein the product is then after treated with an alkali metal alcoholate in an anhydrous medium.