
32 Ill.2d 115 (1965)
203 N.E.2d 897
THE PEOPLE OF THE STATE OF ILLINOIS, Plaintiff-Appellant,
v.
AMERICAN NATIONAL BANK AND TRUST COMPANY, Trustee, et al., Appellees.  (EDWARD J. BARRETT, County Clerk, et al., Cross Defendants, Appellants.)
No. 38632.
Supreme Court of Illinois.
Opinion filed January 21, 1965.
*116 DANIEL P. WARD, State's Attorney, of Chicago, (EDWARD J. HLADIS and RONALD BUTLER, Assistant State's Attorneys, of counsel,) for appellants.
BERNARD ALLEN FRIED, of Chicago, for appellees.
Reversed and remanded.
Mr. JUSTICE UNDERWOOD delivered the opinion of the court:
This is an appeal from an order of the circuit court of Cook County which denies a motion by the plaintiff to dismiss its complaint in a tax foreclosure suit, sets aside a tax sale of certain parcels of real estate, and directs the performance of certain acts by named cross defendant-appellants herein. Included in the court's order is an express finding that there is no just reason for delaying this appeal. The cause comes directly to this court as questions involving the revenue are present.
On September 24, 1962, a proceeding to foreclose general real-estate taxes on certain parcels of real estate in the city of Chicago (held now by American National Bank and Trust Company, trustee and defendant-appellee herein) was instituted in the name of the People pursuant to section 216 of the Revenue Act. Ill. Rev. Stat. 1961, chap. 120, par. 697.
On December 11, 1962, during the pendency of the foreclosure proceedings and before any decree had been entered, T.X. Investment Company, a cross defendant-appellant herein, acting pursuant to section 272 of the Revenue Act (Ill. Rev. Stat. 1961, chap. 120, par. 753), purported *117 to purchase the property here in question for the 1960 general taxes, paying in full all previously unpaid general taxes (up to the date of the purported sale) which had constituted liens against the property, including those involved in the foreclosure proceedings.
On August 16, 1963, plaintiff petitioned the court to dismiss the foreclosure action since payment of the taxes by T.X. Investment Company had extinguished the tax liens upon which the foreclosure was founded. On the same day, American National Bank and Trust Company, as trustee, filed a "cross-complaint", praying a declaration by the court of its "primary, paramount jurisdiction" over the parcels of property in question; that the sale made to T.X. Investment Company was a "sale in error"; that the county clerk of Cook County be directed to expunge such sale from the records; that the purchase money be refunded, and that the cause proceed to final decree and foreclosure sale.
The People subsequently moved to dismiss the "cross-complaint" as well as the original complaint. These motions were denied and an order was entered substantially in accordance with the "cross-complaint". The People and certain other parties herein moved to vacate the order. This was denied, the cause was stayed, and this appeal was thereupon perfected.
While it is clear that the denial of a motion to dismiss is not a final and appealable order, (People ex rel. Bass v. Village of Niles Center, 306 Ill. 145, Newman v. Dick, 23 Ill. 278; 4 Am.Jur.2d 622, Appeal & Error, par. 105), portions of the order here in question, i.e. those setting aside the tax sale and the directives to certain cross defendant-appellants, come sufficiently within the ambit of section 50(2) of the Civil Practice Act (Ill. Rev. Stat. 1963, chap. 110, par. 50(2)) to constitute final adjudications. Consequently, in view of the trial court's express finding that there is no just reason for delaying appeal, jurisdictional prerequisites are satisfied.
*118 For a full appreciation of the questions here involved, it is necessary to relate the circumstances in which they arise. As we observed in People v. Eisenberg, 19 Ill.2d 360, these tax foreclosures are, while nominally prosecuted by the People, actually brought at the behest of interested developers who have studied the potentialities of the property concerned. The developer guarantees a certain minimum bid ($1,237) for delinquent taxes accrued through the year 1946 ($16,449) and offers to pay the full amount of delinquent taxes from thence to date ($5,141). This proposal, together with a certified check, is submitted to the county board for action thereon. If the terms are agreeable to the board, a foreclosure suit is instituted on behalf of the People. The above activity has ordinarily proved favorable to all concerned. The developer acquires the property for a small percentage of the total taxes owing, and the county becomes able to again place the property on the active tax rolls. Here, however, T.X. Investment Company has paid to the county clerk all the delinquent taxes ($21,590), thus removing the reason underlying the commencement of the foreclosure suit. As a consequence, the People have moved to dismiss the proceedings, since the liens upon which foreclosure was predicated were eliminated by the payment of the taxes.
T.X. Investment Company would thus acquire the property in question and would enjoy favorable interest rates should anyone attempt to redeem from it; the county would receive all the delinquent taxes and the property again would be returned to the current tax rolls; the developer (the instigator of the foreclosure proceedings) would be left unrewarded.
At the outset of our discussion of the substantive law here applicable, we must concern ourselves with the appellant's contention that the trial court erred in denying the People's motion to dismiss their own foreclosure complaint. If so, it becomes unnecessary to discuss the substantive aspects *119 of those parts of the trial court's order upon which this appeal is validly predicated, i.e., the setting aside of the tax sale; the mandates to the county clerk and treasurer, etc. Clearly, if the motion to dismiss should have been allowed, it follows that the above orders would not have been necessary. Under the peculiar circumstances here present, disposition of the final appealable orders herein is facilitated by discussion of a normally nonappealable order.
We are governed here by section 52 of the Civil Practive Act (Ill. Rev. Stat. 1963, chap. 110, par. 52) which provides in pertinent part: "(1) The plaintiff may, at any time before trial or hearing begins, upon notice to each party who has appeared or his attorney, * * * dismiss his action or any part thereof as to any defendant, without prejudice, by order filed in the cause. * * * After a counterclaim has been pleaded by a defendant no dismissal may be had as to him except by his consent".
It is conceded that no trial or hearing had begun when plaintiff moved to dismiss, but it is argued that defendant-appellee's "cross-claim" constitutes a counterclaim within the contemplation of the quoted statute and therefore precludes the People from voluntarily dismissing their complaint without the "cross-claimant's" consent. While there is not an abundance of Illinois authority as to what constitutes a counterclaim for our purposes here, it is generally felt that in order for a pleading to amount to a counterclaim, a cause of action must be alleged therein. See e.g. Wilson v. Tromly, 404 Ill. 307; Kars v. Knauf, 13 Ill. App.2d 219; Ill. Rev. Stat. 1963, chap. 110, par. 38.
In the instant case, moreover, it would seem that in order for plaintiff to be precluded from dismissing its own cause, an independent (even though it might arise out of the same transaction) substantive cause of action against plaintiff would be requisite. (I.L.P., Dismissal and Nonsuit, sec. 12). It is clear that the purpose of section 52 is to prohibit claimants from voluntarily dismissing causes instituted by *120 them to the prejudice of other parties named in the complaint who have subsequently properly alleged substantive causes of action against the original claimants. When the counterclaim is properly filed, it becomes, in essence, a separate suit ready for litigation. The legislature evidently felt that the judicial machinery would operate more smoothly and needless delay be avoided if defendants could have their affirmative substantive claims against plaintiffs litigated in one comprehensive proceeding. Here, however, no such substantive claim is alleged against plaintiff. It is difficult to see the purpose of the "cross-claim" as to plaintiff, other than an attempt to preclude plaintiff from dismissing its complaint. It is, as to plaintiff, in substance simply an argument that since the court had acquired jurisdiction over the taxes and property involved in the foreclosures, the tax buyer could not oust the court from jurisdiction nor prevent the foreclosure by its subsequent purchase of the forfeited taxes. However, the plaintiff is ordinarily the master of his cause. He may prosecute or dismiss, as he desires, so long as no party is legally prejudiced thereby nor express statutory prohibitions violated. Where, as here, the filed "counterclaim" fails to state a cause of action against the plaintiff, he is not prevented thereby from taking a voluntary nonsuit. I.L.P., Dismissal and Nonsuit, sec. 12.
It is further contended that once the foreclosure proceeding has been instituted, the court is invested with a "primary, paramount jurisdiction" over the res which is in custodia legis to the exclusion of all  even other branches of the government. If the plaintiff in the foreclosure suit were here arguing thusly, we would be more disposed to listen, but such is not the case. The trial court, seemingly on behalf of the defendant or sua sponte refused to dismiss plaintiff's suit. This action was erroneous. Those who invoke the jurisdiction of the courts do not thereby irrevocably commit themselves to that course of action. Litigation, as a means of resolving disputes, should be employed sparingly. *121 Other methods of solution have long been favorably regarded by the courts, and when, as here, the underlying reason for particular litigation has vanished, the foundation upon which the action stood is ordinarily destroyed.
It is contended by both sides herein that our decision in People v. Eisenberg, 19 Ill.2d 360, is helpful in reaching a determination here. We do not agree. In that case we held that the circuit court could not, by entering a foreclosure decree covering delinquent taxes through the year 1946 and providing therein that the successful bidder at the foreclosure sale must pay subsequent delinquent taxes, affect the county collector's statutory duty of holding the annual tax sale covering delinquent taxes accruing subsequent to the year 1946 and not encompassed within the foreclosure suit. We do not here, nor did we there, disregard the general rule that a court retains jurisdiction over a res concerning which a decree or judgment has been entered, to protect and effectuate that decree or judgment, for the taxes which were the basis of the ultimate litigation in Eisenberg were not before the trial court in the foreclosure suit. The trial court had merely erroneously entered an order purporting to affect a res over which it did not have jurisdiction.
Since, as we have indicated, the trial court erred in refusing to dismiss the complaint, the order of the circuit court of Cook County is reversed and the cause is remanded to that court with directions to allow the motion to dismiss and enter such further orders as may be necessary and consistent with this opinion.
Reversed and remanded, with directions.
