
732 N.W.2d 398 (2007)
2007 ND APP 2
Roland C. RIEMERS, Plaintiff and Appellant and
Johnathan P. Riemers, Plaintiff
v.
STATE of North Dakota, Douglas Herman, Gerald W. Vande Walle, Carol Ronning Kapsner, Mary Muehlen Maring, and Dale V. Sandstrom, Defendants and Appellees.
No. 20060382CA.
Court of Appeals of North Dakota.
April 27, 2007.
*400 Roland C. Riemers (pro se), Emerado, ND.
Douglas Alan Bahr, Solicitor General, Office of Attorney General, Bismarck, ND, for defendants and appellees.
PER CURIAM.
[¶ 1] Roland Riemers appeals from a district court judgment dismissing his case against the State of North Dakota, District Judge Douglas Herman, Chief Justice Gerald W. VandeWalle, Justice Carol Ronning Kapsner, Justice Mary Muehlen Maring, and Justice Dale V. Sandstrom (referred to collectively as "the State"). We affirm the judgment and remand to the district court to determine the State's attorney fees for this appeal.

I
[¶ 2] Riemers sued the State claiming his legal and constitutional rights were denied during proceedings stemming from his divorce. See, e.g., Riemers v. Peters-Riemers, 2004 ND 153, 684 N.W.2d 619; Peters-Riemers v. Riemers, 2004 ND 28, 674 N.W.2d 287; Peters-Riemers v. Riemers, 2003 ND 96, 663 N.W.2d 657. Riemers essentially alleged judicial decisions by District Judge Herman and four Justices of the North Dakota Supreme Court were unlawful and violated his constitutional rights. Riemers requested declaratory and injunctive relief to change the venue of his child support action from Cass to Grand Forks County, for a retroactive child support review hearing, for a finding that absolute judicial immunity is unconstitutional, and any other injunctive relief available. He also requested over $2 million in damages and all reasonable costs and disbursements, including attorney fees. The State moved to dismiss the complaint under N.D.R.Civ.P. 12(b)(vi) for failure to state a claim upon which relief can be granted. The district court granted the State's motion and dismissed the case with prejudice after concluding Riemers' claims were barred by collateral estoppel and judicial immunity.

II
[¶ 3] "The purpose of a N.D.R.Civ.P. 12(b)(vi) motion is to test the legal sufficiency of the statement of the claim presented in the complaint." Ziegelmann v. DaimlerChrysler Corp., 2002 ND 134, ¶ 5, 649 N.W.2d 556. We review the complaint in a light most favorable to the plaintiff, taking as true the well-pleaded allegations in the complaint. Id. The complaint should not be dismissed unless "`it is disclosed with certainty the impossibility of proving a claim upon which relief can be granted.'" Id. (quoting Lang v. Schafer, 2000 ND 2, ¶ 7, 603 N.W.2d 904). If we cannot discern a potential for proof to support the claim we will affirm a judgment dismissing the complaint. Ziegelmann, at ¶ 5.

A
[¶ 4] Riemers argues the district court erred in dismissing the complaint because his claims for damages are not barred by judicial immunity. He contends common law judicial immunity no longer exists, judicial immunity is unconstitutional, and judicial immunity does not apply in this case because the judges' actions were unlawful and outside the scope of their employment.
[¶ 5] Judicial immunity is a long-standing common law doctrine that protects *401 judges from civil liability for their judicial decisions:
The principle of judicial immunity recognizes that although unfairness and injustice to a litigant may result on occasion, it is a general principle of the highest importance to the proper administration of justice that a judicial officer, in exercising the authority vested in him, shall be free to act upon his own convictions, without apprehension of personal consequences to himself. Thus, judges are not liable in civil actions for their judicial acts unless they have acted in the clear absence of jurisdiction. Moreover, a judge will not be deprived of immunity even if the action was in error, was done maliciously, was in excess of his authority, and even if his exercise of authority is flawed by the commission of grave procedural errors.
Brokaw v. Mercer County, 235 F.3d 1000, 1015 (7th Cir.2000) (citations and quotations omitted).
[¶ 6] Section 32-12.2-02(3)(d), N.D.C.C., codified common law judicial immunity and states:
Neither the state nor a state employee may be held liable under this chapter for . . .
d. A claim resulting from a decision to undertake or a refusal to undertake any judicial or quasi-judicial act. . . .
[¶ 7] Although Riemers claims N.D.C.C. § 32-12.2-02 ended common law judicial immunity, the statute says, "[t]his chapter does not create or allow any claim that does not exist at common law. . . ." N.D.C.C. § 32-12.2-02(5). Riemers claims judicial immunity is unconstitutional, but he fails provide any reasoning or authority supporting his argument. Statutes carry a strong presumption of constitutionality, and a party challenging a statute must submit more than a bare assertion that it conflicts with the state or federal constitutions to adequately raise the issue. Riemers v. Grand Forks Herald, 2004 ND 192, ¶ 11, 688 N.W.2d 167. Judicial immunity is a well-established, long-standing legal principle, and we reject Riemers' claim it is unconstitutional.
[¶ 8] Riemers also claims judicial immunity does not apply in this case because the judges disregarded clear statutory and case law, and therefore their acts were illegal and were not judicial acts. We conclude his argument is not persuasive. Judicial immunity is defined by the governmental functions it protects, not the motives of the officer performing those functions. 46 Am.Jur.2d Judges § 64 (2007) ("Judges are not deprived of immunity from a suit for money damages merely because of allegations that they committed grave procedural errors or acted maliciously, corruptly, or with evil motive, intent, personal interest, bad faith, or outright malevolence"). Even if the judges disregarded clear case or statutory law, their actions were judicial acts, and judicial immunity bars Riemers' claims for money damages.

B
[¶ 9] Riemers' claims for declaratory and injunctive relief are also barred. Res judicata and collateral estoppel are well-established doctrines that bar relitigation of claims and issues and promote the finality of judgments. Witzke v. City of Bismarck, 2006 ND 160, ¶ 8, 718 N.W.2d 586
Although collateral estoppel is a branch of the broader law of res judicata, the doctrines are not the same. Res judicata, or claim preclusion, is the more sweeping doctrine that prohibits the relitigation of claims or issues that were raised or could have been raised in a *402 prior action between the same parties or their privies and which was resolved by final judgment in a court of competent jurisdiction. On the other hand, collateral estoppel, or issue preclusion, generally forecloses the relitigation, in a second action based on a different claim, of particular issues of either fact or law which were, or by logical and necessary implication must have been, litigated and determined in the prior suit.
Id. (quoting Simpson v. Chicago Pneumatic Tool Co., 2005 ND 55, ¶ 8, 693 N.W.2d 612).
[¶ 10] Riemers' current litigation attempts to challenge decisions Judge Herman and four Justices of the North Dakota Supreme Court made in proceedings stemming from his divorce action. If Riemers was unhappy with the courts' decisions in his prior litigation, his remedy was to appeal the decision or petition for rehearing. Riemers failed to use the remedies available to redress any wrongs he may have suffered, and the well-established doctrine of collateral estoppel bars him from relitigating these issues in a second action. Riemers' claims for injunctive and declaratory relief are barred.

C
[¶ 11] Riemers argues his complaint should not have been dismissed under N.D.R.Civ.P. 12 because the court accepted evidence outside the pleadings and therefore should have treated the motion as one for summary judgment. Under N.D.R.Civ.P. 12(c), "[i]f, on a motion for judgment on the pleadings, matters outside the pleadings are presented to and not excluded by the court, the motion shall be treated as one for summary judgment. . . ." Riemers claims the State inappropriately cited some of Judge Herman's decisions in Riemers' divorce proceedings in its supporting brief.
[¶ 12] We conclude Riemers' arguments are without merit. It was appropriate for the district court to examine and consider the judicial decisions Riemers was challenging. See, e.g., 61A Am.Jur.2d Pleading § 584 (2007) ("the court may examine and rely on documents which the plaintiff was aware of and relied on in framing the complaint . . ."). The district court did not rely on evidence outside the pleadings, and therefore the complaint was properly dismissed under Rule 12.

III
[¶ 13] The State requests attorney fees for this appeal. An award of costs, including reasonable attorney fees, is authorized under N.D.R.App.P. 38 for a frivolous appeal. An appeal is frivolous if it is "`flagrantly groundless, devoid of merit, or demonstrates persistence in the course of litigation which could be seen as evidence of bad faith.'" Riemers v. O'Halloran, 2004 ND 79, ¶ 16, 678 N.W.2d 547 (quoting Questa Res., Inc. v. Stott, 2003 ND 51, ¶ 7, 658 N.W.2d 756). Judicial immunity and collateral estoppel are well-established and long-standing legal doctrines. We conclude Riemers' appeal is flagrantly groundless, devoid of merit, and demonstrates persistence in the course of litigation which evidences bad faith. We therefore conclude Riemers' appeal is frivolous, and the State is entitled to attorney fees for this appeal. The State did not submit any documentation of its attorney fees, and we remand to the district court for a determination of reasonable attorney fees for this appeal.

IV
[¶ 14] We affirm the judgment of dismissal and remand to the district court for *403 a determination of reasonable attorney fees.
[¶ 15] BENNY A. GRAFF, Surrogate Judge, Chief Judge, WILLIAM F. HODNY and EVERETT NELS OLSON, Surrogate Judges, concur.
