This is wrong on so many levels that it is difficult to know where to start. First - and most importantly - the police are not just patronising and irritating passers by who feel free to offer unwanted and ignorant advice that we can happily laugh off. They are in a position of authority, with the power to direct traffic. There are legitimate circumstances which might require the closure of a road and the police could legitimately tell people not to use it. See Highway code: Giving illegitimate and discriminatory instructions is an abuse of power. If a police officer gives you an order then that really IS restraining you from doing something. You have to be very confident of your rights and optimistic enough to assume that the magistrate doesn't hold equally anti-cycling prejudices if you are going to ignore them - as Daniel Cadden discovered to his cost. The chances are that if a police officer has tried this with one cyclist riding on the road then they will be doing this to others so it is important that an official complaint is made. Second - the advice is plain wrong. Even if you accept the argument that a swearing abuse is friendly advice. Riding on the road is much safer than on a side path (which is why the OP was on the road in the first place) so the analogy would be for a policeman to scream at someone walking along a beach on a windy day that they must immediately leave the beach by climbing the adjacent cliff.