#### Tyrone GREEN, et al., Plaintiffs, John H. Owens, Jr., etc., Movant-Appellant, v. William T. (Billy) FERRELL, et al., Defendants-Appellees. Tyrone GREEN, et al., Plaintiffs, John Edney, et al., Plaintiffs-Appellants, v. William T. (Billy) FERRELL, et al., Defendants-Appellees. Moses BELTON, Individually and on behalf of all others similarly situated, Plaintiff-Appellant, v. William T. (Billy) FERRELL, et al., Defendants-Appellees.

Nos. 80-3013, 81-4047.

United States Court of Appeals, Fifth Circuit.

Jan. 6, 1982.

Rehearing and Rehearing En Banc Denied Feb. 9, 1982.

*1293Shirley E. Payne, Hazlehurst, Miss., for plaintiffs-appellants.

Handy, Fitzpatrick, Gwin, Blough & Lewis, Lucien C. Gwin, Jr., Natchez, Miss., W. V. Westbrook, III, Sp. Asst. Atty. Gen., Jackson, Miss., for defendants-appellees.

Before CLARK, Chief Judge, RUBIN and TATE, Circuit Judges.

CLARK, Chief Judge:

These consolidated appeals arise from the dismissals for lack of subject matter jurisdiction of a prisoners’ class action for equitable relief and an individual prisoner’s action for damages, and from the denial of a pretrial detainee’s motion for leave to intervene. The prisoners’ actions challenged the conditions of confinement at Adams County Jail. After denying the intervention motion filed on behalf of a proposed sub-class of pretrial detainees, the district court certified the prisoner class to include only convicted inmates. The district court erred in dismissing the action and defining the class.

I.

Tyrone Green brought a class action on February 21, 1979, challenging the conditions of confinement at Adams County Jail and seeking declaratory and injunctive relief to remedy violations of the first, eighth, and fourteenth amendments. Adams County Sheriff William T. Ferrell and the Adams County Board of Supervisors were named as defendants. Green, a convicted inmate, sought to represent a class of “all present and future inmates of the Adams County Jail.” James H. Owens, Jr., who had been incarcerated in Adams County Jail since January 18, 1979, moved to intervene *1294in the Green action on March 26, 1979, as representative of a proposed sub-class of present and future pretrial detainees. Owens was released from confinement in April 1979. Later that month, a magistrate, in an order subsequently affirmed by the district court, denied Owens’ intervention motion on standing and mootness grounds. A motion by the class plaintiffs to join another pretrial detainee as a plaintiff, never acted upon by the court, was filed in May 1979. In November 1979, the district court certified the class in the Green action to include “all present and future convicted inmates serving their sentences within the Adams County Jail.”

Meanwhile, Moses Belton, a former Adams County Jail inmate, filed an action against the Sheriff and Board of Supervisors of Adams County seeking damages for himself and equitable relief for a purported class. The district court dismissed the equitable portion of Belton’s claim since he was no longer incarcerated, but permitted the individual damage claim to be maintained. A motion to consolidate the Green and Belton actions was denied by the district court.

Just over one year after the Green action was filed, the district court denied defendants’ motion for summary judgment. The court ordered the parties to both the Green and Belton actions to prepare for a consolidated evidentiary hearing on the issue of jurisdiction. A two-day evidentiary hearing was held, and in November 1980, the district court dismissed both actions for lack of subject matter jurisdiction.

Two separate appeals, consolidated by a previous order of this court, are before us now. First, Owens appeals the district court’s denial of his motion to intervene on behalf of pretrial detainees. Second, the class and individual claimants appeal the district court’s dismissal of their actions on jurisdictional grounds, and its narrow class definition.

II.

After the district court denied the defendants’ motion for summary judgment, it required the plaintiffs to adduce proof demonstrating that its claims of constitutional deprivations had a substantial basis in fact. The court based its requirement of this unique factual showing on language contained in *Bell v. Wolfish,*441 U.S. 520, 99 S.Ct. 1861, 60 L.Ed.2d 447 (1979), and *Smith v. Sullivan,*611 F.2d 1039 (5th Cir. 1980). After examining plaintiffs’ claims in the light of the “proof” presented, the district court found them groundless and dismissed for lack of jurisdiction. We reverse and remand for disposition of the actions on their merits.

A plaintiff’s failure to state a meritorious cause of action does not defeat subject matter jurisdiction. *See Bell v. Hood,*327 U.S. 678, 682, 66 S.Ct. 773, 776, 90 L.Ed. 939, 943 (1946); *Williamson v. Tucker,*645 F.2d 404, 415-16 (5th Cir. 1981); Wright, Miller & Cooper, *Federal Practice and Procedure: Jurisdiction*§ 3564. With few exceptions, subject matter jurisdiction should be determined on the basis of the plaintiff’s complaint. Premerits factual inquiries which affect the existence of subject matter jurisdiction are restricted to such matters as the determination of citizenship of the parties or amount in controversy in a diversity action. See, *e.g., Williamson v. Tucker,*645 F.2d 404, 415-16 (5th Cir. 1981). The factual inquiry conducted by the district court here, rather than seeking to determine some discrete jurisdictional requisite, blanketed the merits of plaintiffs’ claims. Such broad factual attacks on “jurisdiction” cannot be allowed to thwart the requirement that well-pleaded claims must be dealt with on their merits.

The district court misread *Bell v. Wolfish,*441 U.S. 520, 99 S.Ct. 1861, 60 L.Ed.2d 447 (1979), and *Smith v. Sullivan,*611 F.2d 1039 (5th Cir. 1980). Neither case requires a pretrial evidentiary inquiry into the existence of subject matter jurisdiction. *Bell v. Wolfish, supra,*involved a constitutional challenge, rejected by the Supreme Court, to various conditions of confinement and practices at a New York City facility whose inmates were primarily pretrial detainees. *1295The Supreme Court dealt with those constitutional claims after a full merits trial. It never discussed the propriety of a factual inquiry into the existence of subject matter jurisdiction in such cases. The part of *Smith v. Sullivan*relied on by the district court, 611 F.2d at 1046, discussed a prisoner action that had reached the remedial stage. It merely admonished the trial court not to retain jurisdiction over the action if it found that the federal constitutional violations inspiring the action had ceased to exist. “Jurisdiction” as used by the *Smith*court referred to the entire bundle of federal judicial powers, particularly the judicial power to intervene in state prison affairs and remedy constitutional violations.

III.

The class plaintiffs, who sought certification of a broader class, and Owens, the now-released pretrial detainee, appeal the court’s orders which had the cumulative effect of excluding pretrial detainees from the class action.

The constitutional rights of convicted prisoners and pretrial detainees are not coterminous. *See Bell v. Wolfish,*441 U.S. 520, 535-36, 99 S.Ct. 1861, 1872, 60 L.Ed.2d 447, 466-67 (1979). Nonetheless, those rights and the conditions of confinement that impact upon those two groups at the same county jail facility are sufficiently common to warrant contemporaneous consideration in a single judicial proceeding under the circumstances present here. The traits required by Fed.R.Civ.P. 23 exist. The interest in judicial economy promoted by certifying a class including both groups is obvious. The court has ample discretion to protect the interest of pretrial detainees insofar as they differ from those of convicted inmates.

Owens’ motion to intervene as of right or permissively under Rule 24(a)(2) or (b)(2), Fed.R.Civ.P. 24(a)(2), (b)(2), was denied by the district court on mootness and standing grounds, evidently because he was no longer in custody when the intervention and class certification issues were decided by that court. While we have serious doubts about the propriety of the district court’s decision on the intervention issue, our remand order only requires that court to redefine the class to include pretrial detainees. After doing so, the district court should reconsider Owens’ intervention motion, carve out a sub-class of pretrial detainees, or take any other action it deems necessary to protect the distinct interests of class members. We note without elaboration that the same counsel represents Owens and the class plaintiffs.

We also note that the United States District Court for the Northern District of Mississippi has assumed jurisdiction over a plaintiff class of inmates sentenced to Parchman Penitentiary. *Gates v. Collier,*No. GC-71-6K (N.D.Miss.1981) (Order Regarding use of Local Jails for Incarceration of State Prisoners). Included in that court’s order are prisoners serving in local jails such as the Adams County Jail, but under sentences at Parchman. We pretermit any judgment on how the order may affect the district court’s disposition of this case on remand.

We hold that the district court erred in excluding pretrial detainees from the plaintiff class. On remand the district court should reevaluate Owens’ motion to intervene as well as whether to carve out a sub-class of pretrial detainees or try the action on behalf of a single broad class.

REVERSED and REMANDED.