This petition for writ of mandamus arises out of these facts:
The petitioners are David H. Myer, L. Joe Irving, George H. Woolley, Jr., and James B. Hutcheson, who, along with the respondent, J. Joseph O’Mara, and an individual named Howard W. Jones, owned all of the stock of Sand Mountain Fibers, Inc.
O’Mara wanted to buy all of the stock in that corporation, and all other shareholders wanted to sell their stock. These parties signed a contract to that end on September 13, 1990. That sale was completed and the stock was transferred.
Under the terms of the contract, the petitioners and Howard W. Jones agreed to provide certain technical assistance and supervision to complete the assembly of two extrusion lines located at the plant operated by Sand Mountain Fibers, Inc., and O’Mara, as full owner, was to cause Sand Mountain Fibers, Inc., to put up $250,000 to complete those lines. The petitioners were to share with the corporation the next $50,-000 in cost if it exceeded $250,000, and if the cost ran over $300,000 the petitioners were to bear that cost.
A dispute arose, and O’Mara filed a declaratory judgment action against the petitioners in the United States District Court for the Northern Division of Alabama, asking that the court declare the rights of the parties under the contract. Specifically, the complaint filed by O’Mara described the controversy between O’Mara and the other signatories to the contract as follows:
“5. Pursuant to the provisions of the agreement, defendants [petitioners Myer, Irving, Woolley, and Hutcheson, plus *891Howard W. Jones] agreed to provide the necessary technical assistance and supervision to complete the assembly of two extrusion lines ... located at Sand Mountain Fibers, Inc., a corporation all of the outstanding stock of which is owned by plaintiff [O’Mara]. The agreement provides that plaintiff will cause Sand Mountain Fibers, Inc., to provide up to $250,-000 for the completion of the two extrud-ers. The agreement further provides that Sand Mountain Fibers, Inc., and the defendants will share equally in the next $50,000 of project costs and that if the project costs exceed $300,000, the defendants will pay for any additional costs.
“6. Plaintiff has fully complied with all provisions of the agreement in that he has caused Sand Mountain Fibers, Inc., to advance $400,000 to pay the costs of completion of the two extruders. Defendants have failed and refused to pay their portion of the next $50,000 in project costs in excess of $250,000 and to pay for additional project costs in excess of $300,000.
“7. The agreement provides that the defendants will provide technology which will enable the extruders to produce nylon at an acceptable A-Grade yield of 75% and that the nylon will texture at the minimum level set forth in the agreement. The shareholders have failed to meet these requirements of the agreement.
“8. There is a case of actual controversy between the parties to the agreement in that plaintiff contends that plaintiff has fully complied with all provisions of the agreement to be performed on his part and that defendants are due to reimburse plaintiff for one-half of the first $50,000 in project costs in excess of $250,000 and for all of the project costs incurred by plaintiff in excess of $300,-000. Defendants contend that plaintiff has the obligation to continue to make advances for payment of project costs until defendants are able to produce nylon in accordance with, and meeting the requirements of, the provisions of the agreement.”
Three days after O’Mara filed his complaint in the federal court, defendants Myer, Irving, Woolley, and Hutcheson — the petitioners here — filed an action in the Circuit Court of Marshall County alleging a breach of the same contract that is the subject of the federal action. In the state action, in addition to O’Mara the following are listed as defendants: Joseph X. Leirer, Jr.; Sand Mountain Fibers, Inc.; Filtex, Inc.; and O'Mara, Inc.; and various fictitiously named parties. Of these, only O’Mara is a signatory to the contract that is the basis of the controversy.
The complaint in the state action contains three counts. Count one alleged that the defendants had breached the contract by failing to provide the resources necessary to complete the extruders. Count two alleged that fictitiously named defendants had interfered with the contract between O’Mara and the petitioners, and the third count alleged that the defendants had participated in a conspiracy to defraud by making misrepresentations in connection with the contract.
After the state action was filed, the petitioners filed a motion in the previously filed federal action asking the federal court to dismiss that action against them on the ground that the federal action failed to join an indispensable party, specifically Sand Mountain Fibers, Inc., a/k/a Filtex, Inc. O’Mara, as indicated earlier, owns all of the stock of that corporation.
Before the motion to dismiss the federal action was ruled upon, the defendants in the state action filed a motion to dismiss in that case, alleging that a prior action had been filed in the federal court, and that the contract made the basis of the state action was the subject of the federal action. This motion also alleged that the claims in the state court action were compulsory counterclaims in the previously filed federal action.
Before the state court ruled on this motion, the federal court dismissed the federal action and O’Mara appealed that dismissal to the Eleventh Circuit Court of Appeals. Thereafter, the Marshall County Circuit Court put the state action on its adminis*892trative docket pending resolution of the appeal in the federal action and ordered the parties “to proceed with discovery by agreement, to be used in the ultimately surviving case.”
The plaintiffs in the state action then filed this petition for a writ of mandamus asking this Court to order Judge William Gullahorn of the Marshall County Circuit Court to vacate his order.
The writ is denied.
“We note at the outset that mandamus is a drastic and extraordinary writ to be issued only where there is (1) a clear legal right in the petitioner to the order sought; (2) an imperative duty upon the respondent to perform, accompanied by a refusal to do so; (3) the lack of another adequate remedy; and (4) properly invoked jurisdiction of the court.”
Ex parte Edgar, 543 So.2d 682, 684 (Ala. 1989). This Court must determine “whether there has been a clear abuse of discretion by the trial judge in an arbitrary and capricious manner.” Ex Parte Rudolph, 515 So.2d 704, 706 (Ala.1987). Furthermore, “there must be a clear showing of injury to the petitioner.” Ex Parte Johnson Land Co., 561 So.2d 506, 508 (Ala. 1990).
The action of the trial judge in placing this case on its administrative docket and ordering the parties to proceed with discovery pending the decision of the Eleventh Circuit Court of Appeals does not warrant the issuance of the writ of mandamus. In fact, it reflects a pragmatic solution to the reality of this litigation. If the Eleventh Circuit Court of Appeals reverses the district court’s dismissal, this litigation can proceed in the federal court, which first acquired jurisdiction of the core controversy. If it affirms the district court’s dismissal, the controversy between these parties can be resolved in the subsequently filed state court action. In any event, there is no basis for compelling the state trial court by way of mandamus to proceed with litigation that is presently pending in the Eleventh Circuit Court of Appeals.
The issue before this Court is whether the Circuit Court of Marshall County committed an abuse of discretion by placing the state action on the administrative docket pending resolution of the federal action.
Section 6-5-440, Alabama Code 1975, provides in part:
“No plaintiff is entitled to prosecute two actions in the courts of this state at the same time for the same cause and against the same party_ [T]he pend-ency of the former is a good defense to the latter if commenced at different times.”
The “courts of this state” include the federal courts within Alabama. Ex parte Canal Ins. Co., 534 So.2d 582, 584 (Ala.1988). Because the federal action was filed before the state action, § 6-5-440 bars the second action.
The petitioners contend that because they filed no counterclaim in the federal action before it was dismissed, § 6-5-440 is inapplicable to the present case. This Court has previously stated:
“The rule is ... that ‘a second action should be abated, if the party who institutes it is able to obtain in the prior pending action all the relief which he asks in the second, or to which he is entitled; or, as otherwise expressed, a second action should be abated where every material right or question asserted therein could be adjudicated in the prior pending action, or where the whole purpose of the second action is attainable in the first.’ We find no authority which conflicts with this principle.
“Since complainant in this suit seeks relief, all of which is attainable in the first suit, although an amendment of the bill in that case should be made which entitles complainant to all such relief, the trial judge correctly abated the second suit on said plea.”
Edelman v. Poe, 267 Ala. 387, 390, 103 So.2d 333, 335 (1958). This Court in that case affirmed a dismissal of the second suit because the relief sought was available in an earlier filed suit even though that relief had not yet been sought in that earlier suit.
*893Although some of the defendants in the state action are not currently parties to the federal action, they could be joined as counterclaim defendants under Rule 13(h), Fed. R.Civ.P. This ability to join counterclaim defendants in the federal action would not be affected by the fact that there may not be diversity of citizenship between the petitioners and the respondents; the federal court may nevertheless hear such counterclaims under the doctrine of ancillary jurisdiction. H.L. Peterson Co. v. Applewhite, 383 F.2d 430, 433 (5th Cir.1967); 6 Wright & Miller, Federal Practice and Procedure, § 1436 (1990). Therefore, all claims presented in the state action can be alleged and resolved in the federal action.
In addition, the petitioners have made no showing of injury, which is required for the issuance of a writ of mandamus. Petitioners are not being denied the opportunity to have their claims adjudicated against the respondents. If O’Mara prevails in the Eleventh Circuit Court of Appeals, the petitioners will have full opportunity to file counterclaims in the federal court upon remand; if O’Mara loses the appeal, the state action is revived.
Judge Gullahorn’s order putting the state action on administrative hold until the Eleventh Circuit Court of Appeals rules on the dismissal of the federal action avoids a multiplicity of lawsuits based upon the same set of facts and preserves the petitioners’ right to have their day in court. Judge Gullahom committed no abuse of discretion and did not act arbitrarily and capriciously. The petition for the writ of mandamus is therefore due to be denied.
WRIT DENIED.
HORNSBY, C.J., and MADDOX, HOUSTON and KENNEDY, JJ., concur.