The petition states that the plaintiff is the owner of the real estate in controversy, and is entitled to its possession. The defendant admits the plaintiff’s ownership in 1876, but pleaded that in that year the plaintiff mortgaged the same to one McClure, and that the mortgage had been duly foreclosed in 1878, and the real estate sold on special éxecntion to McClure, and the same conveyed to hirp in 1879 by the sheriff, and the defendant claims under McClure. In a reply, the plaintiff pleaded that the decree of foreclosure, and the .sale and conveyance were void, because *422the court had no jurisdiction of the subject-matter, for the reason that no petition had been filed by the cleric which invoiced the jurisdiction of the court. A demurrer to the reply was sustained. It is well settled that a demurrer admits all facts well pleaded. The averment that no petition was on file as above stated is in the nature of a legal conclusion. It therefore becomes material to ascertain what facts were pleaded. In March, 1878, an action was commenced in the circuit court by the service of the requisite notice, and filing a proper and sufficient petition. It does not appear that any pleadings other than the petition were filed, but the court caused the following judgment to be entered: “Now, on this day, this cause comes on for hearing, and, the court being fully advised in the premises, this cause is dismissed at plaintiff's costs,” and a judgment therefor was rendered against him.
The plaintiff insists that the action was dismissed on the merits, and therefore this action on the same mortgage is barred by reason of such adjudication. We are not prepared to say- that such prior adjudication, conceding it to be on the merits, is so pleaded that we are required to pass on such question. The petition filed in the circuit court is entitled in the caption as follows: “In the circuit court of Iowa, in and for Marion county. Petition in equity.” It was marked “ Filed ” by the clerk, and attached to a wrapper, on which were written the following words and figures: “Term No. 119. Case 1252. Chancery, Marion circuit court. Petition foreclosure. Filed February 28, 1878. Allen- Hamrick, Clerk. Dismissed, Appearance Docket 3, p. S8.” After the dismissal of said action, the plaintiff therein caused a notice to be served on the present plaintiff, stating that on a named day a petition would be on file in the district court asking a foreclosure of said mortgage. The attorney for the plaintiff in such action took from the files of the circuit court the petition which had been filed therein, “drew an ink-mark” through the figures “1252” *423on the wrapper, and placed the figures “976” above the former figures; “ drew a line” through the word circuit, and wrote “ district.” The date of filing was also changed. After this was done, the indorsements on the wrapper were 976 as follows: “Term No. 119, Case No. 49®2, Chan-district eery, Marion dree-rt court. Petition, foreclosure. Filed May 2 F-.-ikraarsy 25, 1878. Allen Hamrick, Clerk. Dismissed, Appearance Docket 3, p. 88.” The petition on its face remained entitled in the caption as above stated. After-wards, the district court caused the following entry to be made of record: “Plaintiff appears by his attorneys; and defendants, being duly served with notice, failing to appear, default is entered against them. Cause comes on for hearing upon the petition and evidence adduced by the plaintiff.” And then follows a judgment foreclosing the mortgage. It is evident from the journal entry that the district court found that there was a petition on file; but, as the facts pleaded are admitted by the demurrer, such petition was not addressed to the district, but was addressed to the circuit court, and that such petition had been taken from the files of the circuit court and placed among the files of the district court. That the judgment was obtained on such petition, and is irregular, at least, must be conceded. But the question is, whether it is absolutely void.
It is provided by statute that the “petition must contain the name of the court and county in which the action is brought.” Code, § 2646. The petition in question did so; that is, it contained the name of, and was entitled in, the circuit court, and thereby the jurisdiction of that court was invoked. The words and figures on the wrapper, no matter by whom they were written, do not constitute a part of the petition. The petition constitutes a part of the record of the case; and, as it appeared on its face that it was addressed to the circuit court, it appeared of record that there was no *424petition on file that invoked the action of the district court, and therefore the “latter court had no power to act upon it.” Garretson v. Hays, 70 Iowa, 19.
In Morrow v. Small, 33 Iowa, 118, the petition was entitled in the caption, “In the circuit court.” The clerk indorsed on the back thereof, “Change to the district court,” and placed the cause on the calendar of the latter court, and it was held there was no petition on file in the distinct court. It must therefore follow that such court did not have jurisdiction.
It is true, this is a collateral attack; but, if there was no jurisdiction of the subject matter, the judgment is void. It must be conceded that the district court lias jurisdiction of the foreclosure of mortgages. But it did not have jurisdiction or power to render a judgment foreclosing the mortgage in question, unless there was a petition invoking such action.
In Morrow v. Weed, 4 Iowa, 89, it is said: “ What gives jurisdiction? The answer is — First, the law; second, a petition, (or what stands in its place.) ”
In Smith v. Watson, 28 Iowa,. 218, there was on file a petition addressed “to the judge of the district court of Polk county, Iowa,” but the names of the parties were not stated “ at the head thereof, nor was it headed with the word petition.” It was held that these defects were merely formal. In that case the'petition did invoke the jurisdiction of the court in an informal manner.
We think the court erred in sustaining the demurrer.
Bevejksed.