* School policies: Each school district and individual school will have its own rules about detention or after-school assignments. These policies often specify maximum times.
* State laws: Some states have laws regarding student detention and the maximum time a student can be kept.
* The reason for keeping the student: A short detention for minor misbehavior might be permissible, while keeping a student for an extended period without clear justification or parental consent would likely be illegal.
* Parental consent: For longer periods or activities outside of standard school disciplinary procedures, parental consent is usually required.
In short, while a teacher might *try* to keep a student, the legality and appropriateness depend heavily on context and the specific regulations in place. If a student feels they are being kept unfairly or for an excessive amount of time, they should report it to their parents or a school administrator.