Where do police officers derive their power from?

In a democratic society, the population gives its consent to the government that it elects, and that government appoints police officers. Therefore, police power derives from the society in general. In a dictatorial society, police power derives only from their weapons, since social consent is not required.