The Cossacks is believed to be somewhat autobiographical, partially based on Tolstoy's experiences in the Caucasus during the last stages of the Caucasian War. Tolstoy had a morally corrupt experience in his youth, engaging in numerous promiscuous partners, heavy drinking and gambling problems; many argue Tolstoy used his own past as inspiration for the protagonist Olenin.