THE Government's commitment to an ethical foreign policy was given a small boost yesterday when European Union Foreign Ministers adopted a code of conduct regulating weapons exports.

The agreement may also restore some of Foreign Secretary Robin Cook's battered political prestige and was immediately welcomed by Mr Cook, who has championed the idea of the code throughout Britain's EU presidency.

''I believe the agreement today is a real achievement. It represents a substantial step forward in creating a responsible and effective regulation for the European arms trade,'' he said in Brussels yesterday.

Still recovering from the political row over the arms-to-Africa controversy, Mr Cook insisted that the code of conduct, even if it had been in place at the time, would not have affected the sale of arms to Sierra Leone. ''There was no application for an export licence and the code can only bite when licences are sought and granted,'' he told reporters.

The voluntary code is designed to bring greater openness to the murky world of arms exports and to try and prevent EU countries from undercutting each other in the competition to sell weapons to regimes with debatable human rights records.

Agreement was only reached after the UK, one of the EU's two major arms exporters, had agreed to make two significant concessions to the other, France. Both weakened the original draft code drawn up by the Government and will still give considerable leeway to a country determined to press ahead with arms exports.

Under the guidelines, EU governments agreed not to issue an export licence if there was a clear risk that the equipment might be used for internal repression or external aggression. If in future Britain, for instance, refused to grant an export licence, it will inform all its EU partners of its decision to reject the request.

If, however, another government assesses the same situation differently and sees no difficulty in one of its own companies carrying out the contract, it could not be prevented from doing so and would only have to inform London of its decision.

Mr Cook denied that the code was ''toothless'' and insisted that the procedure ''would inhibit countries from undercutting each other''. He also suggested that the sanction of bad publicity might make some governments think twice before approving an export order which had already been rejected.

''There is no obligation on a member state intending to undercut to make it public. But also there is no obligation on a member state receiving that information to keep it to themselves, and I am sure some member states being undercut might like to bring that to public attention,'' he suggested.

But the Shadow Foreign Secretary, Michael Howard, immediately branded the code ''a farce''. ''Far from making it more difficult for other countries to sell arms which could be used to suppress human rights, it would actually make it easier for them to do so. Britain, for example, would have to notify other EU countries of any order it refuses, so presenting them with these orders on a plate. If they then decide to supply the arms Britain has refused to sell, there is nothing anyone can do to stop them,'' he said.

The code also came in for strong criticism from those EU governments which wanted far tougher restrictions on weapons sales to countries with questionable human rights records.

Ireland's Foreign Minister, David Andrews, complained afterwards: ''I am very unhappy about it and have little confidence in the document as drafted. It is rather specious and unnecessarily light on the human rights aspects, but it is a first step and it is better to have half a loaf than no bread.''