Can refer to physical confinement or metaphorical situations.
El gato estaba encerrado en el baño, esperando a que su dueño lo liberara.
The cat was locked up in the bathroom, waiting for its owner to free it.