(Devarim 16:18) "Judges and officers shall you appoint for yourself": Whence is it derived that a beth-din is appointed for all of Israel? From "Judges … shall you appoint for yourself." And whence is it derived that (police) officers are appointed for all of Israel? From "… officers shall you appoint for yourself."
Appointing Judges and Officers for Every City Gate
Sifrei Devarim 144:1