Rashi (ad loc) quotes the Midrash Tanchuma and defines the role of the officers: "They are the ones that enforce on the people the verdict of the judge, through hitting and restraining them." Rashi seems to be bothered by a remarkable omission in the possuk. The verse starts out saying that we must appoint judges and officers, yet only seems to describe the job of the judges; "and they will judge the nation justly." There is no independent mention of the role of the policemen. Rashi therefore concludes that their role was merely to support the judges, in other words, they are part of the system of courts.
This is a fascinating departure from the American system of jurisprudence. In American law, the judges are in the judicial branch of government but all the enforcement of the law falls under the executive branch. In other words, policemen, sheriffs, and other law enforcement personnel work for the local, state, or national municipality; whether it is the mayor, governor or president. This is because under the American system the judges bear no responsibility for the practical application of law, just the determination of it.
Under the Jewish system of law, the judges are required to not only adjudicate issues that come before them but to also oversee the application and enforcement of the laws. The police force is the enforcement arm of the judicial system. In other words, the American system of jurisprudence simply charges the judges with determining the law while our system makes them fully responsible for the law; charging them with the responsibility of maintaining the integrity of the law as well.
Rambam (Yad Hilchos Sanhedrin 1:1) takes this one step further and explains that the officers not only enforced the laws and administered the punishments for those who violated the laws, they were also responsible for maintaining a moral and honest society. The police were responsible to monitor the markets to make sure there was no price collusion or gouging and that all the weights and measures used in the marketplace were accurate and honest.
In the American system there is a basic understanding that you can do what you want as long as you aren't hurting someone. In our system of law, we are not just concerned with maintaining law and order. Our laws aren't in place just to make sure society doesn't devolve into anarchy; our primary concern is maintaining a moral society that reflects the values of our Torah.