According to a series of recent opinion polls the UK Independence party (Ukip) has overtaken the Liberal Democrats to become Britain's third most popular party. Though, plainly, this is not good news for the Lib Dems and further confirmation of their continuing slide into oblivion, it's clear that the Conservatives have the most to fear. Indeed the Times reported on Tuesday (paywalled link) that the Tories have lost a sixth of their support over the last two months, with much of this going to Ukip. For those of us on the left, anything that threatens to damage the Tory vote might be regarded as welcome. Nevertheless, as Owen Jones recently cautioned, we should be wary about Ukip's rise – indeed we need to start taking Ukip seriously as, in Jones' words, a "potential menace". In order to do this we need to be clear about what Ukip represents.

What's behind Ukip's increasing poll ratings? At first glance the shift in support from the Tories to Eurosceptic Ukip might be interpreted as being driven by current events in the eurozone. Interestingly, though, only a quarter of those considering voting Ukip see the EU as one of the top three issues facing the UK. Indeed, the recent swell in Ukip's support may have much more to do with defection of Conservative supporters over the issue of gay marriage, which Ukip unequivocally opposes. Furthermore, Lord Ashcroft recently suggested that Tory voters are moving to Ukip because they're attracted to its much more draconian stance on immigration and "benefits culture".

Here we come to an apparent paradox. Ukip positions itself on the traditionalist and socially conservative right on issues like homosexuality and immigration and yet, at the same time, loudly trumpets its libertarian credentials – proclaiming itself to be a "democratic libertarian party" for example. But how can we square an apparently libertarian philosophical outlook with the promotion of socially illiberal and authoritarian policies?

Some argue, given the apparent conflict, that Ukip aren't libertarian at all. But this is to misunderstand libertarianism. In reality there's no conflict. As paradoxical as it may seem, rightwing libertarianism has always been a deeply authoritarian political philosophy. It claims to value liberty in some general and all-encompassing sense above all other principles, but the particular types of freedom libertarianism seeks to defend and extend are always, tacitly and implicitly, forms of liberty for the few at the expense of the many. Thus libertarianism stands for the unfreedom of the majority.

There are basically two key historical strands of libertarian thought (which have, over time, become intertwined). The first is based in the liberal natural rights tradition associated with John Locke. Locke argued that individuals have a natural, God-given right to ownership of their own person and thus, by extension, an absolute entitlement to the products of their own labour. This forms the basis of the libertarian commitment to the sanctity of private property. The second strand is rooted in the classical liberal economic thinking of figures such as Adam Smith, Herbert Spencer and, more recently, Ludwig von Mises and FriedrichHayek. The basic thrust of this strand is that unencumbered "free" markets will always tend towards stable equilibrium. Both strands converge on the view that individual freedom is paramount, is synonymous with the defence of private property rights and best flourishes when forms of collective, democratic and/or state intervention (such as regulation or taxation) are minimised.

There are many problems with these arguments – it's clear from the historical record that free markets certainly don't tend toward spontaneous order and stability. Further, libertarians have never come up with a convincing way of demonstrating the existence of any "natural right" to property – Locke evades the problem simply by asserting that such rights exist because God decreed them.

The most important thing to grasp about libertarian thinking, however, is that its particular, very narrow, understanding of liberty is an indication of its class basis. Liberty is defined almost exclusively in terms of private property rights. When approaching issues such as progressive taxation, trade unions, welfare and economic regulation the libertarian will present all of these things as threats to individual liberty. But whose liberty in particular do these things plausibly threaten? All of these measures, in fact, can be regarded precisely in terms of the expansion of freedom – for employees, the poor, the unemployed and so on. It is clear that for all its explicitly proclaimed devotion to the defence of freedom in the abstract, libertarianism is in fact most concerned with defence of the particular and exclusive freedoms of the wealthy, employers and the powerful.

This is, at the same time, a defence of radical social inequality. Hard-nosed libertarians have always been clear about the need for robust systems of law and order – recognition (though not often explicitly stated as such) that social inequalities breed crime and social discontent. Ukip's policy commitments to double the number of prison places and to free the police "from the straitjacket of political correctness" sit squarely in this tradition.

But it's not merely class hierarchy that libertarianism implicitly defends – it's also committed to other forms of domination. Take "race" for example. Libertarian thought has been marked by a distinctly racist dimension from its very beginnings. Spencer, for instance, propounded social Darwinism and favoured a legal ban on interracial marriage. Notoriously, Locke referred to native Americans as "savage beasts" and, indeed his Second Treatise can be read as an elaborate defence of the colonial expropriation of native Americans. It is entirely in keeping with libertarian tradition, then, that Ukip is radically hostile to immigration and to "multiculturalism" (a familiar dog-whistle term for the racist right).

Ukip is also committed, of course, to the defence of uncompromising heterosexism and this often takes vile forms – Ukip MEP Roger Helmer for example recently suggested that gay marriage legislation opened to the door to incestuous marriage. In both cases – immigration and gay rights – Ukip is seeking to tap into an aggrieved sense of rightful superiority on the part of relatively privileged groups and to bolster it through various forms of discrimination against inferior others.

Libertarianism often presents itself as the polar opposite of fascism. In fact libertarianism and fascism have long been bedfellows. Mises supported Mussolini's squadrismo and regarded fascism as a welcome "emergency makeshift" that would save "European civilisation". Hayek was an admirer of Pinochet's Chile. Libertarian support for fascist regimes rested on the observation that they constituted bulwarks of militant defence for private property and associated social hierarchies in the face of perceived or actual threats from the left. This tradition of close co-operation is continued by Ukip today in its various alliances with far-right groups in Europe, with whom Ukip shares a fear of immigration, gay rights and "multiculturalism".

So in the end there's no real paradox in relation to Ukip's libertarianism on the one hand and its "illiberal", authoritarian social conservatism on the other. Libertarianism has always been committed to the restriction of liberty for certain groups in order to augment the freedom (manifested in and through wealth, power and status) of privileged sections of society. If we were to ask, then, whether Ukip is authoritarian or libertarian, socially conservative or libertarian, or even whether it's far right or libertarian, the answer in each case would be that it's both. There's no contradiction.