Detention is the act of holding back someone in official custody especially before they appear in court. It is also a punitive measure used in schools to confine children against their will. Detention is generally used when someone does something wrong.
For example, when someone breaks the law, they are held in detention before they are taken to the court of law to face judgment. In schools also, children are detained after school hours when others must have gone home, and released after a specified duration. This usually occurs when they go against the school rules and regulations such as engaging in a fight or other unacceptable behaviors.
Generally, detention is a temporary confinement or imprisonment. It is of a short duration.