
554 P.2d 163 (1976)
276 Or. 33
WASHINGTON COUNTY, a Political Subdivision of the State of Oregon, Respondent,
v.
Keith M. CLARK, Petitioner.
Supreme Court of Oregon, In Banc.
Argued and Submitted June 9, 1976.
Decided September 3, 1976.
*164 Michael J. Kavanaugh and Russell M. Heath, Portland, argued the cause for petitioner. With them on the briefs was William Bradley Duncan, Hillsboro.
Lawrence Derr, County Counsel, Hillsboro, argued the cause for respondent. On the brief was Gregory S. Hathaway, Asst. County Counsel, Hillsboro.
DENECKE, Chief Judge.
The Court of Appeals affirmed a decree, taken by default, ordering the defendant to remove his house from his property. 24 Or. App. 73, 233, 544 P.2d 1070, 1073 (1976). We granted review.
The facts are as garnered from the evidence introduced at a hearing on defendant's motion to set aside the default and from affidavits and the pleadings.
On January 10, 1974, the plaintiff, Washington County, filed and duly served a complaint alleging that the defendant was building a structure without obtaining a building permit in violation of the building code. It further alleged it had posted a stop-work order on the premises, but the defendant continued construction. Plaintiff prayed for an order requiring the defendant to stop construction and remove the structure.
On plaintiff's motion, an order to show cause why a temporary injunction should not issue was served on defendant. He did not appear and the injunction was issued. Defendant then obtained counsel. Counsel did not file an appearance in response to the complaint, but secured an agreement from the County's counsel that a default would not be taken without prior notice to defendant's counsel and for a reasonable period thereafter. Defendant was notified of this agreement.
A citation was issued and duly served requiring defendant to show cause why he should not be held in contempt for violating the preliminary injunction. Defendant terminated the services of his attorney and did not retain another. Defendant personally had the contempt hearing reset to March 28. Defendant did not appear on March 28 and on March 29 a bench warrant of arrest was served on defendant. On the same day, on motion of the County, the court entered an order reciting that the defendant had failed to answer the complaint and declaring defendant in default. The County's counsel did not notify defendant he was going to take this action.
The County moved to dismiss the contempt proceedings because of a failure of the County to properly allege service on defendant. Immediately prior to this time, the defendant, through new counsel, moved for an order setting aside the order of default. He alleged the order was taken by surprise because it was contrary to the agreement of his former counsel with the County. A proposed answer was attached. In July the trial court denied the motion to set aside the default. In December the court held a hearing on the form of decree to be entered. The defendant was not permitted to cross-examine County witnesses or put on evidence in his behalf. On January 2nd of the next year, the decree appealed from was entered.
ORS 18.160 provides that the court may set aside an order taken against a party through surprise.[1] In Voorhees v. Geiser-Hendryx Inv. Co., 52 Or. 602, 607, 98 P. 324, 326 (1908), we stated:
"A judgment taken against a party contrary to an understanding or agreement with his adversary, is taken against him by surprise within the meaning of the statute * * *, and upon a showing to that effect, seasonably made, should be opened, and the defaulted party permitted to defend, if he has a meritorious defense."
*165 The Court of Appeals cited this case and found the defendant had been taken by surprise. The Court of Appeals, however, affirmed because it was of the opinion that the default should not be set aside because an answer alleging a meritorious defense was not tendered.
The defendant's tendered answer contained a general denial, an affirmative defense, and a counterclaim. The affirmative defense admitted defendant proceeded without a building permit. The affirmative defense and counterclaim alleged, in essence, that the County wrongfully refused to issue a building permit, that the refusal was particularly wrongful because it was for the reason that the county revoked a subsurface sewage disposal permit previously issued to the defendant, and that this permit was wrongfully revoked.
Ordinarily, a default should not be set aside unless a meritorious defense is clearly pleaded. Johnston v. Braymill Co., 142 Or. 95, 96, 19 P.2d 93 (1933). This principle is to enhance judicial efficiency; that is, default judgments should not be opened unless it is shown they are unjust. 1 Freeman, Judgments (5th ed 1925), 552-553, § 280. When, however, a default is taken in breach of an agreement, the integrity of the judicial process is blemished. 1 Freedman, Judgments, supra, at 557, citing Browning v. Roane, 9 Ark. 354, 50 Am. Dec. 218 (1849), states no showing of a meritorious defense is necessary when a default is taken in breach of an agreement. Even if some sort of a showing of a meritorious defense should be required under these circumstances, we should not require exactness of pleadings or an allegation of a complete defense.
The defendant alleged that the plaintiff is estopped to deny the issuance of a building permit. The Court of Appeals held the defendant did not adequately plead the elements of estoppel. Assuming that decision is correct, if the defendant is able to prove at least some of the allegations of his answer, such proof would be relevant on the equities which could be considered in determining the appropriate remedy.
We hold the trial court erred in entering the default decree because a sufficiently meritorious defense to the remedy sought was pleaded.
In so deciding we are not digressing from the frequently stated principle: "A motion to vacate an order of default and judgment under the provisions of ORS 18.160 is addressed to the sound discretion of the trial judge." Coleman v. Meyer, 261 Or. 129, 134, 493 P.2d 48, 50 (1972).[2]
Our decision is in accordance with the further principle: "* * * [T]he court's discretion is controlled by fixed legal principles and must not be exercised arbitrarily, but, rather, it should be exercised to conform with the spirit of the statute and not to defeat the ends of substantial justice." Coleman v. Meyer, supra, 261 Or. at 134, 493 P.2d at 51.
Also, in so deciding we are not condoning what appears to be contemptuous behavior of the defendant or inferentially disapproving of the remedy granted by the trial court.
Reversed with instructions to the Court of Appeals to remand the case in accordance with this opinion.
NOTES
[1]  18.160: "The court may, in its discretion, and upon such terms as may be just, at any time within one year after notice thereof, relieve a party from a judgment, decree, order or other proceeding taken against him through his mistake, inadvertence, surprise or excusable neglect."
[2]  See Lowe v. Institutional Investors Trust, 270 Or. 814, 819, 529 P.2d 920 (1974), for a collection of the latest cases. We are also aware of the ambiguity of the word "discretion."
