The only way to answer this, in my view, is by saying that I would balance these things very carefully. Whenever you have two factors that need to be balanced, it is impossible to completely attend to the needs of both factors. Both factors are important, but both will have to be short-changed to at least some degree.
The best way to manage this tension is to have set standards that are to be followed in the day-to-day management of the jail. If you have standards in place, and if you can show that your standards take into account both the needs of the inmates and the requirements of public safety, you are less liable to have problems with legal challenges to your management.
Another thing to try is the “new-generation jail” concept. In this concept, jails are more open places with greater interaction between inmates and staff. This idea is meant to reduce the number of problems in the jail by allowing inmates and staff to have more personal interactions. Such jails have been shown to be cheaper to run and more secure.
Thus, it seems that the best way to try to balance between these two demands is to have more open jails with greater freedom for inmates while still maintaining standard procedures that are rigorously enforced. This may be hard to implement, but it represents the best hope for providing public safety while still dealing with the problems of jail management.