A magistrate or judge handing down a sentence normally has two main considerations in mind.
One is the right punishment for the offender. The other is the deterrent effect on others.
We should not be at all surprised that, following last week's riots, much more emphasis than is usual is being placed on the deterrent effect.
A crime which in normal times would lead to a small prison sentence, or very possibly no sentence at all, is now likely to attract a swingeing penalty.
In other words, the context in which the crime was committed is rightly judged to be of crucial importance.
Two young men who posted messages on Facebook last week inciting people to riot in their respective home towns have both been sentenced to four years in prison by a judge at Chester Crown Court.
If either of them had done exactly the same thing six months ago, they would have barely been noticed. At most they would have received a rap on the knuckles from the police, and perhaps a caution.
As it is, Perry Sutcliffe-Keenan and Jordan Blackshaw have each received a punishment intended to deter which some people may think excessively harsh.
The justification for the sentence is that their call to violence, delivered at the time it was, supposedly caused some general panic in Warrington and Northwich.
Judge Elgan Edwards QC also said that 'considerable strain' was placed on hard-pressed police officers who were trying to control the riots.
Context is all-important: that is the message which critics of seemingly draconian sentences should take on board.
Last week saw the biggest outbreak of mindless criminality that this - and probably any other civilised - country has experienced in modern times.
Tough measures are needed in such unprecedented circumstances.
But it does not follow that every sentence that has been handed out in the past few days is proportionate. Most of us will have noticed punishments which, notwithstanding what I have said, do seem excessive.
Some police officers fended off gangs of youths intent on ransacking shops and retail centres, but are the sentences for looters appropriate?
A 23-year-old student with no previous convictions has been jailed for six months after he pleaded guilty for stealing six bottles of water said to be worth £3.50 as he was passing a looted supermarket in Brixton.
What a stupid idiot. But, especially in view of his good character and the contrition he showed to the police and magistrates, was this an appropriate punishment?
In Manchester a mother of two, Ursula Nevin, has been jailed for five months for receiving a pair of shorts given to her after they were looted from a city centre store.
Being in receipt of stolen goods is a serious offence, but I can't help feeling that five months in prison is over the top given that she played no part in the riots, though in the event she will probably serve only two or three months.
And, despite the judge's proper strictures, a sentence of four years on the two young men who posted their pernicious messages on Facebook also seems somewhat heavy to me in view of the fact that not a single soul bothered to turn up to their riots.
Both men are intending to appeal, and I will not be surprised if their sentences are reduced.
Please do not mistake me for a weak-kneed liberal. Naturally, I am concerned that during these exceptional times basic principles of justice should be observed.
But I also think that wildly disproportionate sentences - even though they probably constitute a tiny minority of those handed out over the past few days - could lead to an outcome which the upholders of law and order do not want.
Already various anti-penal lobbyists are alighting on miscarriages of justice, and somehow calling the whole judicial process into question.
Predictably, the well-meaning Howard League for Penal Reform and the Prison Reform Trust are stirring uneasily. Not very surprisingly, many Lib Dems are exhibiting signs of querulousness, with one of their MPs describing the Tories' response to the riots as 'bonkers, bonkers, bonkers'.
A few hard cases are being seized by those whose aim it may be to discredit the system.
The danger is that these examples will be blown out of all proportion, and as a result the notion of sentences intended to deter will be altogether undermined as judges and magistrates come under pressure to row back.
Instead of an unusual display of judicial robustness, we may end up with the usual wide array of soggy non-custodial measures which will fail to strike fear into the hearts of actual or prospective rioters, as tough punishments are intended to do.
For it is surely mainly the fear of what may happen to them if they riot, as well the knowledge that police will not tolerate their violence, that will keep would-be rioters and looters off the streets in future.
Of course, I don't doubt that the social measures mentioned by the Prime Minister are also necessary -- more discipline in schools, stronger families, and so forth -- but they come later because they take time. Proper sentencing is the first step.
The people I want to see being sent to prison for considerable periods are not opportunistic stealers of bottles of water or recipients of pairs of stolen shorts or even the instigators of phantom riots, but those who set fire to shops and houses, who threw bricks and other missiles at the police, who terrorised innocent civilians, and who indulged in looting on an industrial scale.
There can be little doubt that there are many such culprits among the nearly 3,000 people so far arrested, and others yet to be apprehended.
It is these real criminals who should be rooted out and properly dealt with, rather the pathetic bit-part players who may have strayed into the action.
To their credit, judges and magistrates are acting as they are not as a result of any political direction from the Government - there has been none - but because they are aware of the enormity of what happened last week.
They may be forgiven if in the heat of the moment, confronted by unprecedented numbers of criminals, they have occasionally been carried away.
They are right to dispense exemplary justice in order to deter, and there is no reason whatsoever why they should not be sensitive to public opinion.
In fact, one cannot escape the irony that in normal times some members of the judiciary seem hardly to care what the public thinks about crime, and sometimes deliver what seem like the shortest sentences possible for serious acts of violence, including rape.
For once, judges and magistrates are for the most part doing what nearly everyone wants.
The pity would be if occasional lapses led to the anti-penal brigade being able to put itself on the high ground, where it would try to undermine the exemplary justice this country needs.