That is in no way at all for this officer to act. And I hope if he truly is an bonafide officer this comes to light and he is reprimanded appropriately.
Can I just clarify something. It may be different in India. Police officers are not law makers. Especially not your run of the mill uniformed officer on the ground. They up hold the law, but they do not make the laws.
I hope you are ok, that must have given you quite a shock.