When a contempt is committed in the immediate view and presence of the court or judge at chambers and the contemptuous conduct requires immediate action in order to restore order, maintain the dignity or authority of the court, or prevent delay, it may be punished summarily. An order must be made reciting the facts that occurred in the judge's immediate view and presence and adjudging that the person proceeded against is guilty of a contempt and that the person must be punished as prescribed in the order. An order may not be issued unless the person proceeded against has been informed of the contempt and given an opportunity to defend or explain the person's conduct. A person may be adjudged guilty of and penalized for criminal contempt under this section by a fine in an amount not to exceed $500 or by imprisonment for a term not to exceed 30 days, or both, and by any other reasonable conditions or restrictions that the court may consider appropriate under the circumstances.
§ 3-1-511, MCA