That sounds precisely like 'detention'. For instance, people are detained pending trial. In fact, imprisonment is also being free to leave after some defined event occurs - namely the completion of sentence. This third option is exactly the first option.