Cosmetic composition, comprises: (i) one or more organosilicon compounds comprising silanes containing a silicon atom and siloxane comprising two or three silicon atoms, where the organosilicon compounds further comprises one or more basic chemical functions and one or more hydroxyl groups or hydrolyzable groups by molecule; (ii) one or more anionic surfactants, and (iii) one or more cationic polymers in a medium. An independent claim is included for method for the treatment of keratin fibers, preferably human keratin fibers such as hair comprising applying the cosmetic composition on the fibers, and rinsing after a possible exposure time.