Real world article
(written from a production point of view)
Shore patrol was a division of the United States Navy tasked with monitoring navy concerns on land.
The original script for Star Trek IV: The Voyage Home had the Navy shore patrol guarding Pavel Chekov' operating room and pursuing the fleeing Starfleet crew, rather than the San Francisco Police Department. However, according to "Operation Hollywood: How the Pentagon Shapes and Censors the Movies", the Pentagon objected, saying it made the Navy appear incompetent, and asked why they couldn't simply beam away instead. [1]