When a person does not understand an established rule, scolding alone may fail to teach it. The Prophet ﷺ prevented further disruption, explained the purpose of the mosque, and had the area cleaned.
Gentleness is not indifference. The action was not approved; it was addressed through a measured response and practical correction.
In schools and mosques, this suggests a useful sequence: identify the problem, prevent further harm, explain the rule respectfully, and remedy the result.