Would you want to be treated by a junior doctor who had just come to the end of a 90-hour, seven-day working week?

As Dr David Reid of the BMA's Scottish Junior Doctors Committee points out, there is evidence that doctors in such circumstances make more mistakes, and who can blame them - anyone forced to work long night shifts for seven consecutive days is bound to be tired and more prone to slip-ups.

What is frustrating is that such gruelling working weeks were supposed to have been banished by the European Working Time Directive, which states that no-one should be forced to work more than 48 hours a week. However, figures published by The Herald today as part of our NHS: Time for Action campaign demonstrate that junior doctors are still routinely doing much more than that. In hospitals across Scotland, some are regularly working 90-hour weeks.

The reason health boards can still get away with this is that rotas on some wards are being organised so that they do not technically breach the European directive, which is part of UK law. Some junior doctors, for instance, will work a 90-hour week and then be given a few days off so that over six months their average working week does not exceed 48 hours. This means health boards can stay within the letter of the law while flagrantly ignoring the spirit of it.

Such chicanery has unpleasant effects for junior doctors. It means that some are working horrendous hours with very little sleep and that is unacceptable for the reason that Dr David Reid has highlighted: it is dangerous for patients and unfair on doctors, who end up feeling like they have perpetual jet-lag.

Admittedly, there have been improvements in the working hours of junior doctors in recent years - as some older consultants are fond of pointing out, there was a time when a 100-hour week was not uncommon - but that is hardly the point. However much the situation has improved, no doctor in the modern NHS should be working a 90-hour week.

So why is it still happening? Clearly, in some departments, as NHS: Time for Action has highlighted, there is a shortage of junior doctors. This is particularly the case in emergency departments and it is not just because of tight budgets, although that is clearly a critical factor; it has also been hard for some hospitals to find the doctors they need with many trainee posts left unfilled.

Longer term, these shortages will have to be addressed if the working hours of junior doctors are to come down, but shorter term, there is something else that health boards can do to improve the situation. As The Herald's figures show, some health boards are doing better than others in controlling the maximum number of hours worked and the obvious conclusion is that if some can do it, so can others.

What this means is that, as a matter of urgency, health boards should look at how their hospital rotas are organised to minimise the chances of junior doctors working 90 hours. We know that some wards would be plunged into crisis if all doctors suddenly had to work 48 hours a week or less, but the working week expected of some junior staff is not only unfair, it is unsafe. Health boards must do more to find a solution.