In theory, yes. Prison is an imperfect solution, and in all probability (assuming Sweden holds true more or less to world standards) the majority of those in prison are not there for violent crimes. This law applies to all crimes which carry a jail sentence, not just murder, rape etc.
The balance between saftey and liberty is not absolute, but we're not talking about a warzone here, I can only speculate but the amount of crime in Sweden of all places must be absolutely minimal. The in this case, the need for freedom outweighs the need for safety. In other circumstances, limiting freedom is essential to basic saftey and survival, but this is clearly not even close to anything resembling that.