Police 'can' do almost anything, legally, even if they "can't", they will. Depends on where you live, but in the US, and here in NZ, virtually anything they do is legal in the sense that even if it is unlawful, they will never have any non-trivial consequence, and what does "illegal" really mean...