
499 N.W.2d 1 (1993)
James E. HUYSER, Plaintiff,
v.
IOWA DISTRICT COURT FOR MARION COUNTY, Defendant.
No. 92-246.
Supreme Court of Iowa.
April 21, 1993.
Dean Stowers of The Rosenberg Law Firm, Des Moines, for plaintiff.
Bonnie J. Campbell, Atty. Gen., John M. Parmeter, Sp. Asst. Atty. Gen., Christina F. Hansen, Asst. Atty. Gen., and M. Elise Pippin, Asst. County Atty., for defendant.
Considered en banc.
PER CURIAM.
James Huyser brought this certiorari action to challenge the district court's order finding him in contempt and sentencing him for failure to comply with the child support provisions of a dissolution decree. His points of contention are: (1) that the district court lacked jurisdiction to act upon the application for a rule to show cause because the application was not supported by an affidavit, and (2) that in considering whether his failure to pay was "willful" the district court improperly refused to consider an agreement between James and the child support obligee to defer payment to a later date.
On November 25, 1992, this court filed an opinion rejecting James's arguments and annulled the writ of certiorari. In response to a petition for rehearing filed by James, that opinion, which was not published, has been withdrawn. In rehearing the issues on this appeal, we find no merit in James's jurisdictional argument. Concerning the effect of the alleged agreement with the support obligee, however, we now conclude that the district court failed to resolve critical factual issues that bore upon the determination of contempt. Consequently, *2 we sustain the writ and remand the case to the district court for further proceedings.
On June 8, 1984, the district court entered a decree dissolving the marriage of James and Jayne Huyser. Jayne was awarded custody of the parties' two minor children. James was ordered to pay $500 per month, per child, payable one-half on the first of the month and the remaining one-half on the fifteenth of the month.
On February 1, 1991, Jayne Huyser, through her attorney, filed an application for finding of contempt based on James's failure to pay child support. An affidavit in support of the application was attached and Jayne alleged that James Huyser had failed to make child support payments as required by the decree and was behind in the sum of $10,345.66. A rule to show cause was issued by the district court and a hearing was set. Several continuances were granted. Eventually, on August 9, 1991, the district court filed a calendar entry continuing the contempt proceeding until further order based on Jayne's application.
On January 22, 1992, the State of Iowa, on behalf of Jayne, filed a new application for order to show cause and application for a security bond. The application alleged that the certified record of the clerk of court/collection services center showed that James had failed to comply with his child support obligation. This application was not supported by an affidavit. The district court then entered an order to show cause concerning James's alleged failure to pay child support. James filed a written explanation of his conduct. He contended that he was financially unable to pay child support over the last year. In addition, he asserted that he had relied on an agreement negotiated with Jayne to defer collection of child support pending the resolution of the defendant's appeal of civil litigation in which James had recovered a large verdict.
Following a hearing, the district court entered its order concerning the contempt. The court determined that James had willfully failed to comply with his child support obligation and that he was in arrears in excess of $20,000. In so ordering, the court made no finding concerning the consequences of the alleged agreement to defer child support. The court adjudged James in contempt and sentenced him to thirty days in the county jail. The mittimus ordering confinement was conditionally withheld as long as James complied with his child support obligation and paid an additional $400 per month for the accrued delinquent support. We subsequently granted James's petition for writ of certiorari.

I. The Jurisdictional Issue.

James contends that the district court was without jurisdiction to consider the January 1992 contempt application because it was not accompanied by an affidavit as specified in Iowa Code section 665.6 (1991). That contention was never raised in the district court. Consequently, in order to prevail upon this argument, James must show that the absence of such affidavit deprives the court of subject matter jurisdiction. In Sharkey v. Iowa District Court, 461 N.W.2d 320, 323 (Iowa 1990), we concluded that, when the alleged contemner appears at the hearing and does not challenge the sufficiency of the acts required to secure jurisdiction at the commencement of the proceeding, any deficiencies are waived. Similar considerations suggest that in the present case the absence of the affidavit may not be urged for the first time on appeal.[1]

II. Failure to Accord Legal Significance to Alleged Agreement to Defer Collection of Child Support.

In his resistance and written explanation filed in response to the order to show cause and in his testimony at the *3 hearing, James stated that he relied on Jayne's agreement to defer collection of child support until the conclusion of his civil litigation. The district court made no mention of the legal significance of that contention in its finding of contempt.
Counsel for the defendant to the petition for certiorari urges that even if such agreement existed it could under no circumstances establish a defense to a citation for willful contempt. This argument is premised on the contention that agreements to waive child support are against public policy and unenforceable. In support of the latter contention and its proper application in contempt actions, the defendant relies on the decisions of the court of appeals in In re Marriage of Sundholm, 448 N.W.2d 688 (Iowa App.1989), and Webb v. Iowa District Court, 416 N.W.2d 95 (Iowa App.1987).
Because the obligation to pay as well as the willful failure to pay is an element in a child support contempt hearing, it is possible to interpret the foregoing decisions of the court of appeals as only deciding whether the out-of-court agreements in those cases terminated the obligation to pay. As to that matter, the language of the court of appeals appears to accurately state the proposition that such agreements are ordinarily ineffective for that purpose. We are not convinced, however, that it is correct to say as a matter of law that a child support obligor's reliance on an agreement with the support obligee may not, under any circumstances, negate the element of willfulness that must be shown in a contempt proceeding.
As we have recognized, for purposes of a finding of contempt,
"willfully" requires evidence of conduct that is intentional and deliberate with a bad or evil purpose, or wanton and in disregard of the rights of others, or contrary to a known duty....
Lutz v. Darbyshire, 297 N.W.2d 349, 353 (Iowa 1990). We decided in Heishman v. Jenkins, 372 N.W.2d 506 (Iowa 1985), that, notwithstanding legal infirmities in the alleged contemner's reasons for failing to abide the court's decree, a good-faith belief in those reasons may offer a valid defense to the claim that violation of the decree was willful. Id. at 510. We believe that the same considerations apply here.
In order to resolve the issue of whether James's nonpayment of child support was willful on the evidence presented, the district court was necessarily required to resolve certain issues of fact. These included whether the agreement was as James contended it was, whether the delinquency on which the contempt citation was based occurred after the alleged agreement and in reliance thereon, and whether under all the circumstances presented, including the alleged agreement, the nonpayment was willful.
Based on the conclusions we have reached, we believe that the writ of certiorari should be sustained, the finding and judgment of contempt vacated, and the matter remanded to the district court for (1) further findings of fact rendered on the existing record in accordance with the dictates of this opinion, and (2) newly issued findings and conclusions as to whether the evidence establishes beyond a reasonable doubt that James was in contempt of the court's decree.
WRIT SUSTAINED.
NOTES
[1]  By failing to determine this issue on the merits, we in no way intimate that an affidavit is required when the district court issues a show-cause order pursuant to Iowa Code § 598.22, following certification of delinquent child support by the clerk or the collection services center.
