'A country at ease with itself.' Thus John Major expressed a heartfelt desire at the beginning of his Premiership. He was drawing on a much earlier source, the English Prayerbook. In 1549, it included a profound hope: 'Give peace in our time, O Lord.' Nearly five centuries later, peace and ease remain elusive. Indeed, Britain has rarely felt less at ease with itself. There appears to have been a breakdown of confidence between what we might term the establishment and a large section of the populace.

Last week, there were riots in a number of cities. In Belfast, Catholics and Protestants virtually joined forces in pursuit of mayhem, while Sinn Fein deplored violence: Satan rebuking sin.

In all cases, there was an element of drink-inflamed hooliganism, but that is not the whole story. A lot of decent people have come to believe that in many respects, the country is broken and that those in charge, far from trying to put this right, are only interested in discriminating in favour of racial minorities.

Much of this is exaggeration, but there is enough tinder to fuel the flames of anger. The grooming scandal is the worst. We should all be ashamed and appalled that this could have happened in what we believe to be a civilised country. For years, children were humiliated and abused. One dreads to think of the long-term psychological damage. But those who should have been in charge, especially the police, seemed mainly interested in avoiding accusations of racism.

Then came Southport and Nottingham. In the latter case, a violent schizophrenic was known to the authorities. He should have been certified. But no: too many blacks had recently been certified, so we must avoid seeming racist. Three people were murdered.

Finally, Southampton and young Henry Nowak. He is stabbed and realises that he is in mortal peril. But his assailant accuses him of racism. How do the police respond? Believe the murderer and put the victim in handcuffs. Mr Nowak could probably not have been saved, but his last moments deserved dignity, not scorn.

So what has gone wrong? First of all, the protesters, and the rioters, blame much of this on uncontrolled immigration. They have a point. As Shabana Mahmood, the Home Secretary, has said, protecting a nation's borders is a fundamental duty of government. This is such a commonsense point that it should not need to be stated. Yet governments have failed and are failing. This is not exclusively Labour's fault. Some of the worst abuses occurred under Boris Johnson, who did not seem to care about illegal immigration.

It is time to start caring. First, there should be a statement that no illegal immigrant will ever be allowed to settle here. If it is impossible to find out the country of origin, the person should be detained in austere conditions, with no prospect of release. At the same time, measures should be taken to identify the people traffickers and, we might hope, their customers.

Many of these customers are no doubt almost admirable. It is hard not to feel sympathetic to those who have struggled hard to find a way to a better life. But others will be refugees from war-torn regions, who will bring their troubles - and their violent instincts - to our shores. It should be a principle that we only admit immigrants who will make good citizens here, such as many workers in the NHS. But we cannot allow ourselves to be swamped.

There is a further complication: asylum. The UN Convention on refugees was drafted in 1951, under the shadow of the horrors of war and the hideous sufferings in those terrible years - and before the onset of mass air travel. But there was one clear proviso. A refugee seeking asylum had to do so in the first safe country he arrived at. There was no question of picking and choosing: of arriving in France and deciding that Britain offered more generous social security arrangements. Whatever one thinks of France - or the Irish Republic - they are safe countries within the meaning of the Convention.

Yet it is not enough to deal with bogus asylum seekers. Throughout the world, countless millions of people are living in wretched conditions. Many of them could claim that they have a justified fear of persecution on political or religious grounds. But we cannot admit them all. We may pray for them. We might subscribe to charities which try to succour the victims in their own countries. But we cannot open our shores to the world's sufferers.

In previous years, we have been generous. Jewish refugees in the 1930s - if only we had encouraged more of them - Hungarians fleeing Soviet persecution after 1956, Ugandan Asians driven out by Amin: they were received, and they almost all became useful citizens. But there was no question of opening our doors to vast numbers of Hong Kong Chinese, most of whom would probably have been hard-working and law-abiding. The numbers made that impossible. Some were given British passports, usually in recognition of loyal service to the Colony, but the vast majority had to accept their new status as Chinese subjects.

Even in the 1980s, refugees were turned away. Every night, British soldiers on border duty in Hong Kong would catch Chinese who were trying to escape into the Colony. No doubt some of them made it. But those who were captured were handed straight back to the Chinese authorities. Any pleas for asylum were greeted with an implacable deaf ear, otherwise the colony would have quickly been over-run by immigrants - and possibly by the Chinese themselves, who would have been furious.

If the public could be convinced that the government was dealing with illegal immigration, there would be much less tension. But that is not the only factor. It is widely believed that the police have been encouraged to discriminate in favour of racial minorities. The claim is made that if you are an ambitious young copper, the way to earn promotion is not by proving yourself as a thief-taker. You ought to attend seminars on race and gender in a multi-ethnic society, so that you can learn to talk like a sociologist.

This may be exaggerated. But the case of Henry Nowak will stay in the memory. Again, the solution lies in a reassertion of principle: the principle of equality before the law. Outside the Old Bailey, there is a statue of Justice. She is wearing a blindfold. That should be impressed on the consciousness of all those charged with administering and defending the law. It symbolises a vital requirement: equality before the law.

The British public used to have confidence in the police. Some of us can recall the time when policemen were unarmed and called you 'sir' if you asked for directions. A bit more of that spirit would help. There was also widespread confidence in the Common Law, a splendid inheritance. From time almost immemorial, it has protected our liberties and our property. There is no need for foreign judges to tell us how to govern ourselves. The quicker the European Convention on Human Rights is sent packing across the Channel, the better.

It should not be impossible to restore public confidence in our legal system. But until a government takes the necessary steps to do so, the public mood will continue to darken.