
743 N.W.2d 1 (2007)
Kenneth W. TURNER, Appellant
v.
IOWA STATE BANK & TRUST COMPANY OF FAIRFIELD, Iowa, and Earl Wallace Dick, Appellees.
No. 06-0490.
Supreme Court of Iowa.
December 14, 2007.
Michelle L. Heller of Nepple Law, PLC, Muscatine, for appellant.
Myron L. Gookin of Foss, Kuiken, Gookin, Cochran, P.C., Fairfield, for appellees.
*2 WIGGINS, Justice.
In this appeal we must decide whether the district court erred when it sustained a motion to dismiss. Our court of appeals reversed the district court's ruling, and on further review we agree the district court improperly sustained the motion to dismiss. Accordingly, we affirm the decision of the court of appeals, reverse the judgment of the district court, and remand the case for further proceedings consistent with this decision.
I. Prior Proceedings.
On October 24, 2005, Kenneth W. Turner brought an action in the Adair County District Court against co-trustees Iowa State Bank & Trust Company of Fairfield, Iowa and Earl Wallace Dick. Turner's petition contained one count and alleged various wrongdoings regarding the co-trustees' work on his father's trust, the Gene L. Turner Residuary Trust. Attached to Turner's petition were various documents in support of his claims. These documents included the will of Gene Turner, which created the trust. The other documents consisted of correspondence between attorneys and a pleading from an action between Turner and his mother, Mary Christine Turner, Gene Turner's wife.
The co-trustees responded to Turner's petition by filing a combined motion for change of venue and motion to dismiss. The motion to dismiss alleged Turner's present action was "barred by adjudication, consent, or other limitation" based on his failure to raise the claims as of May 6, 2004, which was the deadline for filing objections to the final report of the trust. Alternatively, the co-trustees claimed the action was barred because Turner's action was filed more than one year after the date he received the final report and accounting in the trust matter. The co-trustees relied on Iowa Code section 633A.4504 (2005)[1] to support their motion to dismiss. In their motion the co-trustees alleged facts in addition to those contained in the petition. They also attached documents in support of their motion.
Turner filed a resistance to the motion, arguing the one-year statute of limitations in section 633A.4504 did not apply to his claim because his claims were independent from those raised in the trust matter. He argued the two-year statute of limitations found in section 614.1(2), which applies to personal injuries or injuries to the reputation, is applicable to some of his claims while the five-year statute of limitations for breach-of-written-contract claims in section 614.1(4) is applicable to others. He also argued res judicata, issue preclusion, or claim preclusion were not applicable to his new claims because they were independent from his claims in probate.
The district court granted the co-trustees' motion to dismiss. Turner appealed. In their reply brief, the co-trustees requested an award of attorney fees. A divided court of appeals reversed the district court's ruling sustaining the motion to dismiss, denied the co-trustees' claim for attorney fees, and remanded the case with directions for the district court to address the co-trustees' motion for change of venue. The co-trustees petitioned for further review, which we granted.
II. Motions to Dismiss Generally.
A court can grant a motion to dismiss if the plaintiff fails to state a claim upon which any relief may be granted. Iowa R. Civ. P. 1.421(1) (f). On appeal we *3 review a district court's ruling on a motion to dismiss for correction of errors at law. See Iowa R.App. P. 6.4; see also Mlynarik v. Bergantzel, 675 N.W.2d 584, 586 (Iowa 2004). A court cannot consider factual allegations contained in the motion or the documents attached to the motion. Berger v. Gen. United Group, Inc., 268 N.W.2d 630, 634 (Iowa 1978). The court must ignore these facts, except those of which the court may take judicial notice. Winneshiek Mut. Ins. Ass'n v. Roach, 257 Iowa 354, 365, 132 N.W.2d 436, 443 (1965). In determining whether to grant the motion to dismiss, a court views the well-pled facts of the petition in the light most favorable to the plaintiff, resolving any doubts in the plaintiff's favor. Rees v. City of Shenandoah, 682 N.W.2d 77, 79 (Iowa 2004). The purpose of the motion is to test the legal sufficiency of the petition. Berger, 268 N.W.2d at 634.
We have previously discussed the pitfalls a party encounters when a person files a motion to dismiss. Cutler v. Klass, Whicher, & Mishne, 473 N.W.2d 178, 181 (Iowa 1991). There we stated:
We recognize the temptation is strong for a defendant to strike a vulnerable petition at the earliest opportunity. Experience has however taught us that vast judicial resources could be saved with the exercise of more professional patience. Under [our rule governing motions to dismiss] dismissals of many of the weakest cases must be reversed on appeal. Two appeals often result where one would have sufficed had the defense moved by way of summary judgment, or even by way of defense at trial. From a defendant's standpoint, moreover, it is far from unknown for the flimsiest of cases to gain strength when its dismissal is reversed on appeal.
Id. In other words, a court will rarely dismiss a petition for a failure to state a claim upon which any relief may be granted. Id; see also Am. Nat'l Bank v. Sivers, 387 N.W.2d 138, 140 (Iowa 1986) (stating "it is a rare case which will not survive a [motion to dismiss]").
III. Factual Basis of Turner's Claims.
Considering the well-pled facts of the petition in the light most favorable to Turner and disregarding the factual allegations contained in the motion to dismiss and its attachments, we find the facts as follows.
Gene Turner died on October 2, 2000. He was married to Mary Christine Turner and had two children, Duane and Kenneth. Duane predeceased his father but left two children, Douglas Turner and Stacy Turner-Richards. In Gene Turner's will he created a trust for the benefit of his wife with his sons or their issue named as residuary beneficiaries. When the court closed the estate, Kenneth and Douglas were named co-trustees. Kenneth and Douglas had several disagreements so the court appointed Iowa State Bank and Dick as successor co-trustees in April of 2003. Sometime thereafter, the family members entered into a family settlement agreement ending the trust and disbursing the assets. The terms of the agreement are not included in Turner's petition.
On October 12, 2004, the court entered an order enforcing the settlement agreement. On October 22 the court entered an order closing the trust and discharging the trustees. At the same time Turner filed this action, he appealed the order closing the trust and discharging the trustees. In an unpublished opinion, the court of appeals affirmed the order. In re Trust of Turner, No. 04-1835, 715 N.W.2d 768, 2006 WL 468611, at *5 (Iowa Ct.App. March 1, 2006).
*4 Turner's petition contains three claims. The first claim is for damages against the co-trustees for their failure to pay Turner's legal fees arising from his successful defense of a criminal trespass charge. Turner was charged with trespassing on the trust property at a time he and Douglas were co-trustees. At the criminal trial the court found Turner not guilty. Turner claims the final report of the trust as filed by the successor co-trustees should have contained a provision indemnifying him for the legal fees he incurred in defense of the criminal action.
The second claim against the co-trustees is for their interference with the family settlement agreement. In this claim Turner alleges the family members entered into an agreement settling the disputes concerning the trust. The agreement called for closing the trust and disbursing the assets of the trust. Turner claims the co-trustees interfered with the family settlement agreement by their actions in distributing the trust assets.
The third claim is for damages arising out of the co-trustees' breach of an agreement not to interfere with any lawsuits brought between beneficiaries of the trust. Turner claims the co-trustees breached this agreement by conspiring with his mother to file an action to have Turner declared incompetent.
IV. Co-trustees' Motion to Dismiss.
To support their motion to dismiss, the co-trustees rely solely on the Iowa Code section that provides:
Unless previously barred by adjudication, consent, or other limitation, a claim against a trustee for breach of trust is barred as to a beneficiary who has received a final account or other report adequately disclosing the existence of the claim, unless a proceeding to assert the claim is commenced within one year after the earlier of the receipt of the accounting or report of the termination of the trust relationship between the trustee and beneficiary.
Iowa Code § 633A.4504(1). The co-trustees make two arguments under this section. First, they argue the trust proceedings in the probate court barred Turner's claims in this action based on the theory of res judicata, issue preclusion, or claim preclusion. Second, they argue the one-year statute of limitations contained in section 633A.4504(1) bars Turner's claims. The co-trustees make no claim that should the court consider the uncontroverted allegations as true, Turner's petition fails to state a claim recognized by Iowa law.
A. Res Judicata, Issue Preclusion, or Claim Preclusion. To decide this issue it is necessary for the court to have before it the appropriate court records from the prior case upon which the co-trustees claim the theory of res judicata, issue preclusion, or claim preclusion bars the present claims. In a motion to dismiss based on the plaintiff's failure to state a claim upon which any relief may be granted, the court can only consider the well-pled facts, not the factual allegations contained in the motion or the documents attached to the motion. Berger, 268 N.W.2d at 634. Turner's petition contains none of the necessary allegations or documents to support the co-trustees' position that Turner's claims are barred by the theory of res judicata, issue preclusion, or claim preclusion. Even if we were to take judicial notice of the probate action where the court of appeals affirmed the closing of the trust and the discharging of the trustees, we cannot say with any certainty the issues raised in the probate action are identical to those raised in Turner's petition in the present case. Accordingly, at this stage of the proceedings we cannot determine if the theory of res judicata, issue *5 preclusion, or claim preclusion bars Turner's claims. See Johnson v. Ward, 265 N.W.2d 746, 749 (Iowa 1978) (holding res judicata can be raised by a motion to dismiss if the nature of the prior adjudication appears on the face of the petition or arises from taking judicial notice of the petitions in pending cases, from which it is indisputable that they present identical causes of action against the defendant); see also Smith v. Smith, 513 N.W.2d 728, 731 (Iowa 1994) (holding a defense of res judicata cannot be raised by a motion to dismiss); Bickford v. Am. Interinsurance Exch., 224 N.W.2d 450, 454 (Iowa 1974) (same). These defenses are better suited to be raised through a motion for summary judgment, where the necessary supporting documentation can be submitted for consideration by the court in ruling on the motion.
B. Statute of Limitations. A defendant may raise the statute of limitations by a motion to dismiss if it is obvious from the uncontroverted facts contained in the petition that the applicable statute of limitations bars the plaintiff's claim for relief. State ex rel. Krupke v. Witkowski, 256 N.W.2d 216, 218 (Iowa 1977). The co-trustees argue Turner's claims are barred by the one-year limitation period found in section 633A.4504(1). The limitations provision of this section bars a beneficiary's claim against a trustee for a breach of trust by a beneficiary
who has received a final account or other report adequately disclosing the existence of the claim, unless a proceeding to assert the claim is commenced within one year after the earlier of the receipt of the accounting or report of the termination of the trust relationship between the trustee and beneficiary.
Iowa Code § 633A.4504(1).
In order to sustain the co-trustees' motion to dismiss, the uncontroverted allegations of Turner's petition must establish: (1) he is a beneficiary of the trust; (2) the claim against the co-trustees is for a breach of trust; (3) Turner received a final account or other report adequately disclosing the existence of the claim; and (4) he failed to commence his action within one year after the earlier of the receipt of the accounting or report of the termination of the trust relationship between the trustees and beneficiary.
The uncontroverted allegations of Turner's petition establish the first element. He is a beneficiary of his father's residuary trust. However, we cannot conclude under this record whether the second element is establishedthat Turner's claims against the co-trustees are for a breach of trust.
A trustee breaches his duty of trust when he violates a duty owed to the beneficiary. Iowa Code § 633A.4501. The Iowa Trust Code contains numerous duties a trustee must perform. These include the duty to administer the trust in accordance with the terms of the trust and the trust code, id. § 633A.4201; the duties of loyalty, impartiality, and confidentiality, id. § 633A.4202; the duty to inform and account, id. § 633A.4213; and the duty to manage the assets of the trust prudently, id. § 633A.4302. The Iowa Trust Code contains the remedies a beneficiary may seek for a breach of trust. Id. §§ 633A.4502-03.
Turner's first claim is for the co-trustees' failure to pay Turner's legal fees arising from his successful defense of the criminal trespass charge. Although Turner is a beneficiary of the trust, viewing the allegations of the petition in the light most favorable to him, Turner is alleging he is entitled to reimbursement for these fees as a creditor of the trust. Therefore, we cannot say the uncontroverted facts of *6 the petition establish this claim as one for breach of trust.
Turner's second and third claims involve the co-trustees' interference with the family settlement agreement and a lawsuit between him and his mother. The co-trustees' motion to dismiss did not challenge whether such actions are maintainable under Iowa law, rather they argue these actions are nothing more than breach-of-trust claims that are barred by the statute of limitations contained in section 633A.4504.
In these claims, Turner alleges the co-trustees did not breach a duty owed to him as a beneficiary, but that the co-trustees tortiously interfered with the family settlement agreement and the lawsuit with his mother. If we assume for the purposes of this opinion Turner's claims of tortious interference are actionable under Iowa law, these are not breach-of-trust claims. Rather these are independent claims outside the purview of the trust code. See Huffey v. Lea, 491 N.W.2d 518, 520 (1992) (reaffirming that Iowa recognizes an independent action outside the probate code for tortious interference with a bequest). Therefore, these claims may not be subject to the one-year limitation contained in section 633A.4504(1). See Frohwein v. Haesemeyer, 264 N.W.2d 792, 793-95 (1978) (holding the tort of intentional interference with a bequest is an independent claim and not subject to the limitations period of the probate code).
V. Attorney Fees.
The co-trustees argue Turner should be required to reimburse them for their attorney fees because Turner's actions are baseless. Our rules of civil procedure contain a provision for sanctions, including the reasonable expenses and attorney fees incurred by a party, when another party files a frivolous pleading. Iowa R. Civ. P. 1.413(1). The rule allows a court to impose sanctions upon its own initiative or upon the motion of a party. Id. The court did not consider the imposition of sanctions on its own initiative. The co-trustees did not move for sanctions in the district court. Therefore, we will not consider the imposition of sanctions for the first time on appeal. Fennelly v. A-1 Mach. & Tool Co., 728 N.W.2d 181, 187-88 (Iowa 2007).
VI. Motion for Change of Venue.
The district court was not required to rule on the co-trustees' motion for change of venue because it sustained the motion to dismiss. On remand the court should consider the motion for change of venue before proceeding further with the case.
VII. Disposition.
The order of the district court sustaining the co-trustees' motion to dismiss is reversed, and this matter is remanded for further proceedings consistent with this opinion.
DECISION OF COURT OF APPEALS AFFIRMED; DISTRICT COURT JUDGMENT REVERSED AND CASE REMANDED.
NOTES
[1]  In 2005, the legislature directed the code editor to transfer the Iowa Trust Code to chapter 633A.2005 Iowa Acts ch. 38, § 54. Accordingly, all references to the Iowa Trust Code are to chapter 633A.
