So what changed? Why did religious freedom come to the West? Why did Locke and Voltaire become heroes of religious freedom, but not Castellio? The answer lies in fundamental institutional changes that took place in European states between 1500 and 1800.

In return for granting rulers political legitimacy, religious authorities could require secular rulers to enforce religious conformity. The bargain appealed to secular rulers too, as they believed that religious competition generated political instability.

It made sense for medieval states to rely on religious institutions to carry out administrative tasks for them, and to provide public goods.

Crucially, it took political and institutional changes specifically, the growth and strengthening of the ability of states to create and enforce rules to make religious freedom in the West possible and appealing.

The intellectual importance of Bayle, Locke and Voltaire does not mean that their ideas were central to religious freedom as it developed and came to be in actual political and social life.

According to the conventional narrative, freedom of religion arose in the West in the wake of devastating wars fought over religion. It was catalysed by powerful arguments from thinkers such as John Locke, Baruch Spinoza, Pierre Bayle and Voltaire. These philosophers and political theorists responded to the brutality of the religious wars with support for radical notions of toleration and religious freedom. Their liberal ideals then became embedded in the political institutions of the West, following the American and French Revolutions.

The first change was the transformation in the scale of European states. In the late Middle Ages, medieval rulers began to invest in building administrative capacity and to raise taxes more regularly.

Rather than relying upon tax farmers, the church or merchant companies to raise taxes on their behalf, rulers invested in vast bureaucracies to do it directly.

The new modern states that emerged in Europe after 1600 subordinated all alternative sources of power the nobility and the church to one sovereign authority.

The process of centralisation and bureaucratisation brought other important consequences. It meant that identity rules had to be abandoned.

The establishment of relatively powerful and secular states that no longer required religious legitimation shifted the political equilibrium in favour of religious freedom and dismantled the old system of identity rules.

Once this institutional change had taken place, elite opinion shifted in favour of religious freedom.

The indirect consequences of moving from identity rules to general rules were even more important. Identity rules had limited the scope of trade and the division of labour. As these identity rules were removed as guilds lost authority, and cities and lords lost their ability to charge internal tariffs trade and commerce expanded.

What implications does our argument have for the modern world? Most important perhaps is the need to recognise that liberal ideas were not necessarily responsible for the emergence of liberal societies.

The actual adoption of any meaningful practice of religious freedom followed neither from the arguments of philosophers, nor from the nature of Protestant belief, but from the political impossibility of achieving conformity after 1600 as Protestantism grew more and more sectarian.

Finally, the history of how religious freedom came to be is a reminder that commitment to liberal values alone is not enough for liberalism to flourish.