In busy offices up and down the land some of Britain's most idealistic young men and women – working in human rights NGOs and immigration law firms – struggle every day to usher into this society as many people as possible from poor countries.

They are motivated by the admirable belief that all human lives are equally valuable. And like some of the older 1960s liberal baby boomers, who were reacting against the extreme nationalism of the first half of the 20th century, they seem to feel few national attachments. Indeed, they feel no less a commitment to the welfare of someone in Burundi than they do to a fellow citizen in Birmingham. Perhaps they even feel a greater commitment.

Charity used to begin at home. But the best fast-stream civil servants now want to work in DfID, the international development department. Their idealism is focused more on raising up the global poor or worrying about global warming than on sorting out Britain's social care system.

Many people on the left, indeed many Guardian readers, are sympathetic to these global citizen values: they see that the world has become smaller and more interdependent, and feel uneasy about policies that prioritise the interests of British citizens. The progressive assumption seems to be that it is fine to have an attachment to friends and family, and perhaps a neighbourhood or a city – "I'm proud to be a Londoner" – and, of course, to humanity as a whole. But the nation state – especially a once dominant one like Britain (above all its English core) – is considered something old-fashioned and illiberal, an irrational group attachment that smart people have grown out of.

Intellectual sophistication is, more generally, associated with transcending the local, the everyday, the parochial, and even the national. Replacing the nation with other allegiances seems an attractive, even morally superior, alternative – chiming with globalisation's market freedoms.

We have multiple identities and networks, both local and global, and our rights are protected by international human rights treaties – the nation state, as the political cliche has it, is too big for most of the local things that matter, too small for most of the big international things, such as climate change and nuclear proliferation.

The global citizen worldview also tends to be suspicious of communities. Or rather the idea of community is praised in the abstract but rejected in the particular in favour of a "cruise liner" theory of society in which people come together for a voyage but have no ongoing relationship. This individualistic view of society makes it hard for modern liberals to understand why people object to their communities being changed too rapidly by mass immigration – and what is not understood is easily painted as irrational or racist.

It also explains why this brand of liberalism is unmoved by worries about integration. If society is just a random collection of individuals, what is there to integrate into? In liberal societies, of course, immigrants do not have to completely abandon their own traditions, but there is such a thing as society, and if newcomers do not make some effort to join in it is harder for existing citizens to see them as part of the "imagined community". When that happens it weakens the bonds of solidarity and in the long run erodes the "emotional citizenship" required to sustain welfare states.

Many of my best friends, as they say – in business, academia and the arts – sign up to this global citizen worldview, a sort of mirror image of the strident chauvinism you often hear in rightwing politics and media. But I believe many of these "progressive" beliefs are not only wrong, but are unintentionally damaging to the goals of the social democratic left that many of them pursue.

Large-scale immigration from poor countries to rich is not the best way to achieve a more equal world or to help poor countries to develop. The young idealistic lawyer in the immigration law firm may believe that he or she is doing God's work, or the secular equivalent, but they are usually acting on behalf of a tiny sliver of the global population – the better-off, more mobile people in poor countries who, understandably enough, do not want to wait the several generations it might take for, say, Uganda to become a rich, stable, liberal country such as Britain. The idealistic lawyer is working in the face of the overwhelming opposition of his or her fellow British citizens and against the express wishes of most poor-country governments, who need to hold on to their most dynamic citizens.

Nor is bypassing nation states the route to better global governance. It is true that the world has become smaller and many of its biggest problems can only be solved with international co-operation, but it does not follow that the nation state is therefore powerless and irrelevant. Nations remain the building blocks of international co-operation and only they can bring democratic legitimacy to global governance.

The rhetoric of globalisation, by dwelling on those things that constantly flow across national borders – trade, finance, transport, media, immigrant diasporas – ends up painting a partial picture. (Most of the above are, in any case, still regulated by national laws or international agreements.) It also leaves out areas such as welfare, where the nation state is more enmeshed in people's lives than 50 years ago: think of tax credits. And, in 2008, in that most global of industries – finance – it suddenly became clear that it really matters which national taxpayers stand behind your bank.

Perhaps most important of all, the global citizen worldview misreads just how liberal most rich-nation states such as Britain have become. This is part of a bigger story about western values in the 20th century. In the mid-20th century, political elites in the liberal democratic west began to embrace what the sociologist Geoff Dench has called the "universalist shift" – the belief in the moral equality of all people. This went further than equality before the law and meant that differences of sex, class and, above all, race, were no longer obstacles to someone's full membership in a society. Although the idea did not extend to economic inequality, it was profoundly anti-hierarchical and demanded that power and rewards in society be justified by performance rather than inherited characteristics (such as whiteness or maleness or membership of a propertied class).

This political and legal egalitarianism was not new, but in earlier eras was a largely utopian idea associated with religion (we are all equal in the eyes of God) or radical political movements and Enlightenment philosophers. What brought this idea of moral equality into the mainstream? Two world wars, the Holocaust, anti-colonial movements and the stirrings of the civil rights movement in the US all combined to change human consciousness, at least in the developed world, in the mid-20th century. (Democracy itself was a factor too, with its equality of status within the community of citizens – one person, one vote – establishing itself in most rich countries only in the first part of the 20th century.)

After the publication of the 1948 Universal Declaration of Human Rights, the principle of moral and political equality came to be written into the constitutions and legal systems of all liberal democracies. Along with the American civil rights movement, it prompted, for example, Britain's pioneering anti-race-discrimination legislation of the mid-1960s. The moral and legal equality implied in the universalist shift was not always fully embraced in practice, but it became a standard against which to judge the behaviour of states; it was so used by the 1968-ers against authority in general, and against racism by the leaders of the first, post-colonial, immigrant generation in Britain.

It now seems so banal to believe in the moral equality of all people that we have forgotten what a novel and revolutionary notion it is, and how many people around the world still have traces of more racial and "groupist" worldviews.

All of us in mainstream politics in the developed world now believe in human equality. But too many progressive people have taken the universalist shift a step further – into a challenge to all national borders and loyalties. If all human lives are equally valuable, how can we any longer favour our fellow national citizens over the impoverished masses of the global south? This "post-nationalism" nags away at the conscience of many liberal-minded people.

But it is a category error. It does not follow from a belief in human equality that we have equal obligations to everyone on the planet. All people are equal but they are not all equal to us. Most people in Britain today accept the idea of human equality, but remain moral particularists and moderate nationalists, believing that we have a hierarchy of obligations starting with our family and rippling out via the nation state to the rest of humanity. Britain spends 25 times more every year on the NHS than on development aid. To most people, even people who think of themselves as internationalists, this represents a perfectly natural reflection of our layered obligations, but to a true universalist it must seem like a crime.

Many people on the left are still transfixed by the historic sins of nationalism. But if people are squeamish about the word "nation" they should use another: citizenship or just society. And the modern law-bound, liberal nation state is hardly a menacing political institution. You join automatically by birth (or by invitation) and an allegiance to the liberal nation state is compatible with being highly critical of the current social order and with support for bodies such as Nato and the EU.

Indeed, the modern nation state is the only institution that can currently offer what liberals, of both right and left, want: government accountability, cross-class and generational solidarity, and a sense of collective identification. As societies become more diverse, we need this glue of a national story more not less. This is ultimately a pragmatic argument. The nation state is not a good in itself, it is just the institutional arrangement that can deliver the democratic, welfare, and psychological outcomes that most people seem to want. It is possible that in the future more global or regional institutions might deliver these things; the EU is one prototype but its current difficulties underline what a slow and stuttering process this is likely to be. (Germany, the least nationalistic of the big European states, was happy to spend about $1tn on unification with east Germany but is very reluctant to spend much smaller sums supporting the southern European economies.)

Anti-nationalists also underestimate just how much the nation state has liberalised in recent decades. One might say that the great achievement of post-1945 politics, in Europe at least, has been to "feminise" the nation state.

The nation was once about defending or taking territory and about organised violence. But now that Britain's participation in a world war is highly improbable, the focus has switched to the internal sharing of resources within the nation – and the traditionally feminine "hearth and home" issues of protecting the young, old, disabled and poor. Notwithstanding recent trimming, Britain's social security budget has increased 40% in just the last 15 years.

The modern nation state has become far more inclusive in recent generations and is underpinned by unprecedented social provision, free to all insiders – but towards the outside world it has become, or is trying to become, more exclusionary. There is nothing perverse or mean-spirited about this. As the value of national citizenship in Britain has risen, so the bureaucracy of border controls has had to grow.

No one knows for sure how many people would come to live in a rich country like Britain if border controls were abolished. But in many poor parts of the world, in Africa in particular, there has been rapid urbanisation without industrialisation or economic growth or job creation. That has created a large surplus of urban labour well connected enough to know about the possibilities of life in the west and with a miserable enough life to want to get there. Who could say confidently that 5 million or 10 million people would not turn up in the space of a couple of years, especially to a country with the global connections that Britain already has?

The American academic Dani Rodrik plays a game with his economics students, asking them whether they would rather be poor in a rich country or rich in a poor country (where rich and poor refer to the top and bottom 10% of a country's income distribution). Most of them opt for being rich in a poor country. But they are wrong, at least if you just look at incomes. The poor in a rich country are, in fact, three times richer than the rich in a poor country, defined as that top 10% and not just the tiny number of the super-rich. That means our economic fortunes are primarily determined by what country we are born in and not by our position on the income scale. Being born in a country such as Britain, or being able to get here from a poor country, means winning the lottery of life.

It is hardly surprising that so many people are battering on our door to be allowed in. But allowing them in, at least in large numbers, not only creates conflict with poorer people in rich countries but slows down the development of poor countries.

A few countries, such as the Philippines, have become part-dependent on exporting people to rich countries and benefit in many ways from the process. But they are the exception. Most poor countries are actively hostile to permanent emigration. And it is hardly surprising. Desperately poor countries cannot afford to lose their most ambitious and expensively educated people. Phil Woolas, Labour's former immigration minister, recalls a meeting with the Sierra Leone foreign minister in 2008 in which she said: "Your country has just given me £150m to invest in infrastructure, and I am very grateful for that, but the trouble is that 90% of our graduates are in the US or Europe. Can you do anything about that for me?"

Emigration from poor to rich countries is obviously an economic benefit to the individuals and their families – a doctor from Ivory Coast will earn six times more in France, and a Chinese junior lecturer can earn five times more in Australia. And the cost of "brain drain" from poor countries is partly mitigated by the remittances sent home. Annual global remittances are about $160bn – more than twice foreign aid flows and a big chunk of GDP in some countries.

But just as rich countries can become over-dependent on immigration, which then reduces the incentive to improve the training or work ethic of hard-to-employ native citizens, so poorer countries can become over-dependent on emigration, which provides a flow of remittance money but slows the "take-off" to a more productive economy.

There is a particular concern over the importing of skilled health staff by rich countries. Malawi, for example, has lost more than half of its nursing staff to emigration over recent years, leaving just 336 nurses to serve a population of 12 million. Rates of perinatal mortality doubled from 1992 to 2000, a rise that is in part attributed to falling standards of medical care. Excluding Nigeria and South Africa, the average country in sub-Saharan Africa had 6.2 doctors per 100,000 of population in 2004. This compares with 166 in the UK, yet about 31% of doctors practising in the UK come from overseas, many from developing countries.

There is nothing morally objectionable about Britain refusing entry to skilled people from poor countries, or insisting that students or temporary workers from such countries return home after their visas expire. Indeed, if people return to their country of origin after a few years in a rich country it may produce the best outcome of all, a remittance flow followed by the return of a more skilled and worldly citizen eager for change. But this requires a reliable and well-funded immigration bureaucracy in Britain that commands public confidence – something that the UK Border Agency can only aspire to at present.

Rich countries should be saying: we will help you to grow faster and to hold on to your best people through appropriate trade and aid policies; we will also agree not to lure away your most skilled people, so long as you agree to take back your illegal immigrants (which many countries don't). The coalition government's combination of a lower immigration target and its exemption of the aid programme from cuts is an expression of this idea.

Another way in which a mutually beneficial "stay at home" policy might operate is by professional and academic bodies in rich countries encouraging more contact with counterparts in poor ones. Academic and professional exchanges and other forms of networking can help to reduce the isolation that many professionals in poor countries feel.

An asylum system that is too open can also have the unintended consequence of encouraging the most reform-minded people in semi-authoritarian countries to quit rather than stay and fight for change. When the UN Refugee Convention was established in 1951, the Soviet gulag was a reality and the Nazi genocide a recent memory. The convention currently states that anyone is entitled to asylum if they are being persecuted on grounds of "race, religion, nationality, membership of a particular social group or political opinion". As Charles Clarke, the former Labour home secretary, has observed: "These are wide-ranging categories which, depending on your definition of persecution, probably cover hundreds of millions, if not billions, of people living in a world where international communications means that more and more people are aware of their 'rights' and seek to take them up." And human rights case law is gradually widening the definitions.

But many of the largest groups, such as Somalis, applying to enter Britain and other rich countries as refugees are not facing individual persecution but rather are caught up in regional conflicts or civil wars or even natural disasters. They have usually been granted "exceptional leave to remain" or what is now called "humanitarian protection". There is no reason why the leave to remain should be permanent. Civil wars and natural disasters come to an end and countries need rebuilding. Rich countries should try to provide shelter from the storm for people badly affected but then ensure they return to help that rebuilding. As it is, refugees are often dumped in the poor parts of rich western cities where they sometimes live segregated and unhappy lives and can become a long-term welfare burden.

I would guess that 95% of British people think policy should give priority to the interests of national citizens before outsiders should the two conflict, but that does not mean you cannot be an internationalist or think it's a valuable part of our tradition to give a haven to refugees.

A new progressive "stay at home" contract can still appeal to altruistic and charitable instincts in the west, but would work with, and not against, the majority interest in both rich and poor countries. Attracting so many of the world's brightest and best into cities such as London seems an oddly lopsided way of arranging global affairs. Surely it would be in the longer-term interests of rich countries and poor to spread development more evenly.

The bigger point here is the most basic insight of welfare economics. Just as the marginal extra pound is worth more to a poor person than to a rich person, so the educated and ambitious person is worth more to a poor country that has few of them than to a rich country that already has many.

Indeed, mass emigration from poor countries creates a kind of development distortion, the human equivalent of global trade and fiscal imbalances: the best-educated people leave countries that badly need them for rich countries that can certainly benefit from their arrival, but do not need them in any proper sense. Some lucky people end up speeding up the development process for themselves and their families while helping to slow it down for everyone else back home.

What's so idealistic about that?

• David Goodhart's The British Dream is published on 1 April by Atlantic.