Not sure where you're getting this from. Police have no duty to protect or serve, this was just a slogan on squad cars in some departments and became a TV trope. If they take some sort of oath, it's not really legally binding.
See: https://www.nytimes.com/2005/06/28/politics/justices-rule-po...