The union is safe in the embrace of the Scottish raj

On the eve of the 300th anniversary of the 1707 Anglo-Scottish union, perhaps the most remarkable fact is that this union of two historic nations has survived so long. Today it has more critics in Scotland than at any time since the 18th century, a mood that seems to be reflected in the electorate. Nationalists cheered the publication last week of an opinion poll in which 52% of Scottish respondents were in favour of independence.

As European history shows, mere geographical proximity is not sufficient to sustain a long-term union. Northern Ireland and the Irish republic, Spain and Portugal, Norway and Sweden - all provide examples of connections that have proved to be ephemeral. The possibility of a similar breach between England and Scotland has become for many a much more realistic scenario with the rise of Scottish nationalism from the 60s and the permanent changes devolution has wrought on the political relationship.

The first five decades of the 20th century, however, saw what might be called the zenith of unionism. The Conservative and Unionist party won four of the seven general elections between the wars. The foundation of the Scottish National party in 1934 showed that not all Scots were in the unionist camp, but its successive failures at the polls demonstrated that the vast majority were. The second world war further buttressed British identity. As plucky Britain stood alone against an evil foe, every nook and cranny of life was affected and the nation geared up for total war.

When living standards started to improve in the 50s and the years of austerity faded into the past, unionism in Scotland seemed impregnable. But all was not well with the Scottish economy. The long period of Britain's relative decline against international competitors, which lasted from the 60s to the 90s, was about to begin.

The rise of the SNP, the new and pragmatic interest in devolution by Westminster and a fresh vitality in Scottish culture were all signs of the times. In the 80s, the imposition of unpopular policies by the Thatcher governments, for which Scotland had not voted, put more steel into the Scottish electorate and their politicians. Any ambiguity about the relevance of a Scottish parliament to the future of the nation quickly receded.

Over half a century on from the high noon of unionism in the 1950s, the issue is whether the time-honoured connection will survive for much longer in the new millennium. In 2004, around three-quarters of Scots felt "exclusively" or "mainly" Scottish, a significantly higher proportion than the equivalent measures in England and Wales. These "Scottish" loyalties are especially common among the younger generation.

But that awareness need not mean that political independence is inevitable. It may be yet another manifestation of the union's historic capacity not only for flexibility but for giving full and easy scope for the Welsh, English and Scots to express their cultural and ethnic identities within a UK framework.

Perhaps inevitably, most recent comment in the media and among academics has been about reasons for the decline of Britishness over the past half-century. The obvious checklist might include the waning of Protestantism (a key ideological British resource for earlier generations); the end of empire and Britain's fall for a time to the status of a second-rate power; the huge and increasing importance of Europe and the parallel decline in the authority of the British state; and, not least, the ebbing of respect for the institution of monarchy. Moreover, since the collapse of the Soviet threat, there has been the loss of a clear "other", an external enemy that can help to sustain British national solidarity against a common foe.

Whether all this means that a political divorce is likely is less certain. Three hundred years of union have resulted in multiple familial, personal, economic and cultural connections between the two nations. Many hundreds of thousands of Scots have long migrated to England. Less well known is the continuous movement in modern times into Scotland. Between 1841 and 1911 an estimated quarter of a million English and Welsh men, women and children came north. At the last census (2001). Scotland had more than 400,000 English-born residents, by far the nation's largest immigrant group.

Not so long ago it was possible to speak with concern about the "Englishing" of Scotland. More common nowadays is reference to the "Scottish raj" in English politics and media, and the capital's financial institutions. The story of the Midlands MP who asked why the Scots should need a parliament when "they are running ours" may be apocryphal but still strikes a chord. The Scots may have felt themselves to be provincials from time to time and may have often been the butt of gentle English humour, but such minor irritations have never prevented them achieving the highest positions in politics, business or academe south of the border. That fact may continue to secure the union in the long term, but only - crucially - if the mistakes of the past, both distant and recent, are avoided.

TM Devine. TM Devine is Sir William Fraser, a professor of Scottish history and palaeography at the University of Edinburgh, and author of The Scottish Nation: 1700-2007.