In a subtle and complex piece, ‘Marxism and the National Question’ (1913), Stalin explicitly links the policy of the RSDLP on national self-determination with religion. Here he writes of both freedom of religion and the need to agitate against the harmful, reactionary elements of religion:
The programme of the Social-Democrats contains a clause on freedom of religion. According to this clause any group of persons have the right to profess any religion they please: Catholicism, the religion of the Orthodox Church, etc. Social-Democrats will combat all forms of religious persecution, be it of members of the Orthodox Church, Catholics or Protestants. Does this mean that Catholicism, Protestantism, etc., “do not contradict the precise meaning” of the programme? No, it does not. Social-Democrats will always protest against persecution of Catholicism or Protestantism; they will always defend the right of nations to profess any religion they please; but at the same time, on the basis of a correct understanding of the interests of the proletariat, they will carry on agitation against Catholicism, Protestantism and the religion of the Orthodox Church in order to achieve the triumph of the socialist world outlook.
The same logic applies to the national question:
The same must be said of self-determination. Nations have a right to arrange their affairs as they please; they have a right to preserve any of their national institutions, whether beneficial or harmful – nobody can (nobody has a right to!) forcibly interfere in the life of a nation. But that does not mean that Social-Democracy will not combat and agitate against the harmful institutions of nations and against the inexpedient demands of nations. On the contrary, it is the duty of Social-Democracy to conduct such agitation and to endeavour to influence the will of nations so that the nations may arrange their affairs in the way that will best correspond to the interests of the proletariat.
‘Marxism and the National Question’, in Works, vol. 2, pp. 368-69.