Yes, according to international law. In fact, not to resist occupation is treason. The kid is a hero. Like a French kid who resisted the Nazis in Paris, he deserves a freedom medal.
High Court: Illegal West Bank homes to be demolished (Haaretz)
from the article: IDF soldiers detain five-year-olds; what have we become?