[¶ 1] Wayne Zahn appeals from a district court order finding him in contempt of court. We affirm, concluding the district court did not abuse its discretion in finding Zahn in contempt.
I
[If 2] Zahn and an acquaintance, Ida Fre-gien, were each charged with disorderly con *739 duct following an altercation between them. Zahn appeared in Dickey County District Court on July 18, 1996, as a witness for the State in Fregien’s trial. Because Zahn had previously engaged in disruptive behavior in the courthouse and in the courtroom, the district court warned him about possible contempt charges if such behavior continued.
“THE COURT: Before we get started, I’m going to address Mr. Wayne Zahn, who is a witness in this case. Mr. Zahn, based on your prior behavior in this Courtroom and in this Courthouse, I am going to give you a warning that you will behave yourself in this Courthouse, show proper respect to the Court and when you testify as a witness—
“MR. ZAHN: (Inaudible)
“THE COURT: —when you testify as a witness, you will answer the questions of the attorneys and not offer any extraneous information. If you step out of line on that warning, I will hold you in contempt of court and put you in jail. Do you understand that?
“MR. ZAHN: I guess I did not know I was on trial here.
“THE COURT: Do you understand what I said?
“MR. ZAHN: Yes, I do sir.
“THE COURT: Okay. Now I would like you to move over to this side of the Courtroom so you’re not behind Ms. Fre-gien.
“MR. ZAHN: I see how this gonna happen. I’m—
“THE COURT: Mr. — -Mr. Zahn—
“MR. ZAHN: I’m out of here—
“THE COURT: Mr. Zahn—
“MR. ZAHN: —I’m out of here.
“THE COURT: You are in contempt of court.
“MR. ZAHN: Cause I can’t leave this courtroom?
“THE COURT: You cannot leave under these circumstances.
“MR. ZAHN: When can I leave?
“THE COURT: You can leave when I say you can leave. You are here as a witness.
“MR. ZAHN: I’m not going to testify. I see how this going to happen already. I—
“THE COURT: Mr. Bohannon, Mr. Zahn is [in] contempt of court; take him into custody. I am sentencing him to ten days in jail.”
The district court charged him with contempt under N.D.C.C. § 27-10-01.3.
[¶ 3] Zahn appeals from the July 18, 1996, contempt order of the Dickey County District Court. The district court had authority to issue the order under N.D.C.C. § 27-10-01.3(2). We granted Zahn’s motion for stay pending appeal on July 22,1996. This Court has jurisdiction under N.D. Const. Art. VI, § 2, and N.D.C.C. § 27-10-01.3(3). This appeal is timely under N.D.RApp.P. 4(c).
II
[¶ 4] Under N.D.C.C. §27-10-01.1(1):
“ ‘Contempt of court’ means:
“a. Intentional misconduct in the presence of the court which interferes with the court proceeding or with the administration of justice, or which impairs the respect due the court;
[[Image here]]
“e. Intentional disobedience, resistance, or obstruction of the authority, process, or order of a court ...;
“d. Intentional refusal of a witness to appear for examination, to be sworn or to affirm, or to testify after being ordered to do so by the court.”
“The ultimate determination of whether a contempt has been committed is within the trial court’s sound discretion.”
City of Grand Forks v. Dohman,
*740 III
[¶ 5] Zahn argues • under the Fifth Amendment privilege against self-incrimination, he cannot be forced to testify in Fre-gien’s trial. Therefore, he argues, the trial court abused its discretion in charging him with contempt for refusing to testify.
A
[¶ 6] “The Fifth Amendment to the United States Constitution provides an accused with a privilege against self-incrimination: ‘No person ... shall be compelled, in any criminal case, to be a witness against himself.’ ”
State v. Beaton,
[¶7] Zahn argues because he is a “co-defendant” in this case, he has the same rights under the Fifth Amendment as the defendant.
See State v. His Chase,
B
[¶ 8] A witness can invoke the privilege against self-incrimination.
Matter of Contempt of Grajedas,
IV
[¶ 9] The district court found Zahn in contempt and ordered him incarcerated for ten days. See N.D.C.C. § 27-10-01.3(2) (“[t]he judge presiding in an action or proceeding may impose a punitive sanction upon a person who commits contempt of court in the actual presence of the court”); see also N.D.C.C. § 27-10-01.4(2)(b) (allowing “a fine of not more than five hundred dollars, imprisonment in the county jail for not more than thirty days, or both”).
[¶ 10] In its order on summary contempt, the court imposed the ten-day incarceration “for the purpose of preserving order in the Court and to protect the authority and dignity of the Court.” See N.D.C.C. § 27-10-01.3(2) (“[t]he judge shall impose the punitive sanction immediately after the contempt of court and only for the purpose of preserving order in the court and protecting the authority and dignity of the court”).
A
[¶ 11] Under N.D.C.C. § 27-10-01.1(c), “[i]ntentional disobedience, resistance, or obstruction of the authority, process, or order of a court” constitutes contempt.
[¶ 12] Intentional disobedience of a court order constitutes contempt. N.D.C.C. § 27-10-01.1(c);
Blaesing v. Syvertson,
[¶ 13] We recognize the “necessity of maintaining the dignity of and respect toward the courts.” 17 Am.Jur.2d
Contempt
§ 1 (1990). The court has the inherent power to maintain order in the courtroom.
In Interest of J.S.,
[¶ 14] A court can punish disrespectful behavior “even when the behavior is a reaction to a court order which eventually is determined to be invalid.”
Kidd v. Caldwell,
B
[¶ 15] Generally, a court should give “fair warning that the continuance of certain conduct would risk contempt,” unless the conduct is clearly contemptuous. 17 Am. Jur.2d Contempt § 178 (1990). If a warning is required, the district court can rely only on conduct subsequent to the warning in finding a person in contempt. See 17 Am.Jur.2d Contempt § 178 (1990) (imposing a contempt sanction is not justified if a warning was required and not given).
[¶ 16] “A person may be held in contempt for refusal to obey a subpoena duly served on him in a pending action.” 17 Am.Jur.2d Contempt § 138 (1990). Zahn was not, however, under subpoena.
[¶ 17] A warning is required where the conduct is not clearly contemptuous. See Dohman at 71 (affirming contempt order where defendant verbally attacked jurors after the verdict was read); 17 Am.Jur.2d Contempt § 178 (1990). Zahn refused to follow the judge’s order and proceeded to leave the courtroom. We conclude Zahn’s statement he intended to leave and his conduct indicating he was leaving were “clearly contemptuous” without prior warning.
C
[¶ 18] Even if there had been a duty to warn, the court clearly warned Zahn. At the beginning of the trial, the court said:
“Before we get started, I’m going to address Mr. Wayne Zahn, who is a witness in this case. Mr. Zahn, based on your prior behavior in this Courtroom and in this Courthouse, I am going to give you a warning that you will behave yourself in this Courthouse, show proper respect to the Court.... If you step out of line on that warning, I will hold you in contempt of court and put you in jail.”
[¶ 19] In
State v. Goeller,
V
[¶ 20] The district court did not abuse its discretion in finding Zahn in contempt.
[¶ 21] After being warned, and before the district court held him in contempt, Zahn disobeyed the court’s order by trying to leave the courtroom, and by words and actions, Zahn impaired the respect due the court.
[¶ 22] We conclude the district court’s finding of contempt in this case was not an abuse of discretion. The order of the district court is affirmed. The district court may order Zahn’s surrender upon notice to complete his sentence.
