It was of course the constitution of the USSR. The constitution of 1924 contains this crucial declaration, indicating that one of the key factors involved ethnic diversity (or what it likes to call the ‘national question’):
The will of the peoples of the Soviet republics, who recently assembled at their Congresses of Soviets and unanimously resolved to form a “Union of Soviet Socialist Republics,” is a reliable guarantee that this Union is a voluntary association of peoples enjoying equal rights, that each republic is guaranteed the right of freely seceding from the Union, that admission to the Union is open to all Socialist Soviet Republics, whether now existing or hereafter to arise, that the new union state will prove to be a worthy crown to the foundation for the peaceful co-existence and fraternal co-operation of the peoples that was laid in October 1917, and that i t will serve as a sure bulwark against world capitalism and as a new and decisive step towards the union of the working people of all countries into a World Socialist Soviet Republic (Stalin, Works 5, p. 404).
A constitution is always a work in progress, so the 1936 version (sponsored by Stalin) extended affirmative action to women, religion, education and so on:
Article 122. Women in the U.S.S.R. are accorded equal rights with men in all spheres of economic, state, cultural, social and political life. The possibility of exercising these rights is ensured to women by granting them an equal right with men to work, payment for work, rest and leisure, social insurance and education, and by state protection of the interests of mother and child, prematernity and maternity leave with full pay, and the provision of a wide network of maternity homes, nurseries and kindergartens.
Article 123. Equality of rights of citizens of the U.S.S.R., irrespective of their nationality or race, in all spheres of economic, state, cultural, social and political life, is an indefeasible law. Any direct or indirect restriction of the rights of, or, conversely, any establishment of direct or indirect privileges for, citizens on account of their race or nationality, as well as any advocacy of racial or national exclusiveness or hatred and contempt, is punishable by law.
Article 124. In order to ensure to citizens freedom of conscience, the church in the U.S.S.R. is separated from the state, and the school from the church. Freedom of religious worship and freedom of anti-religious propaganda is recognized for all citizens.
Incidentally, article 124, which Stalin included in the face of stiff opposition, eventually led to the rapprochement between Stalin and the church during and after the Second World War. The church petitioned for churches to be re-opened, religious personnel to be admitted to jobs, and religious candidates ran in the 1937 legislative elections.
By 1977, the revised constitution summed up the affirmative action position as follows:
Article 34. Citizens of the USSR are equal before the law, without distinction of origin, social or property status, race or nationality, sex, education, language, attitude to religion, type and nature of occupation, domicile, or other status.
The equal rights of citizens of the USSR are guaranteed in all fields of economic, political, social, and cultural life.
Article 35. Women and men have equal rights in the USSR.
Exercise of these rights is ensured by according women equal access with men to education and vocational and professional training, equal opportunities in employment, remuneration, and promotion, and in social and political, and cultural activity, and by special labour and health protection measures for women; by providing conditions enabling mothers to work; by legal protection, and material and moral support for mothers and children, including paid leaves and other benefits for expectant mothers and mothers, and gradual reduction of working time for mothers with small children.
Article 36. Citizens of the USSR of different races and nationalities have equal rights.
Exercise of these rights is ensured by a policy of all-round development and drawing together of all the nations and nationalities of the USSR, by educating citizens in the spirit of Soviet patriotism and socialist internationalism, and by the possibility to use their native language and the languages of other peoples in the USSR.
Any direct or indirect limitation of the rights of citizens or establishment of direct or indirect privileges on grounds of race or nationality, and any advocacy of racial or national exclusiveness, hostility, or contempt, are punishable by law.
Needless to say, constitutions express certain ideals that are not are always practised in reality, but in its initial articulation it was the first affirmative action constitution in the world.