
612 F.3d 571 (2010)
John W. SWEENEY, Petitioner-Appellant,
v.
Byran BARTOW, Respondent-Appellee.
No. 10-1447.
United States Court of Appeals, Seventh Circuit.
Submitted April 16, 2010.
Decided July 8, 2010.
*572 John W. Sweeney (submitted), Winnebago, WI, pro se.
Before BAUER, POSNER, and EVANS, Circuit Judges.
POSNER, Circuit Judge.
The appellant pleaded guilty in 1995 to two counts of third-degree sexual assault, see Wis. Stat. § 940.225(3), was sentenced to prison, and completed his prison sentence in November 2007. But before he was released, the state sought an order from a Wisconsin state court to detain him as a "sexually violent person." See Wis. Stat. §§ 980.01(7), 980.02. He moved to dismiss the state's case. He argued that the use of his assault convictions as the basis for civil detention as a sexually violent person would infringe the ex post facto clause of the federal Constitution because third-degree sexual assault had been added to the list of sexually violent offenses after he had committed the assaults and indeed after he had been prosecuted, convicted, and sentenced for them. His motion was denied, and after exhausting his state remedies (Wisconsin allows a party to seek permission to appeal an interlocutory order, such as the denial of a motion to dismiss, Wis. Stat. § 808.03(2); State v. Webb, 160 Wis.2d 622, 467 N.W.2d 108, 112 (1991)), he sought federal habeas corpus, lost, and now seeks a certificate of appealability, as he had to do because he is detained pursuant to a judicial rather than an executive order. Evans v. Circuit *573 Court of Cook County, 569 F.3d 665, 666 (7th Cir.2009).
The district court dismissed the habeas corpus petition on the authority of Younger v. Harris, 401 U.S. 37 (1971), which (with irrelevant exceptions) requires federal courts to abstain from interfering with pending state proceedings to enforce a state's criminal laws and certain other types of law as well. Although the petitioner's attempt to get the state courts to drop the proceeding to commit him civilly as a sexually violent person failed, he has not yet been ordered civilly committed; he is awaiting a hearing in the commitment proceeding.
The Supreme Court has applied the Younger doctrine to state proceedings that though not criminal enforce other important state interests, such as prohibiting employment discrimination, Ohio Civil Rights Comm'n v. Dayton Christian Schools, Inc., 477 U.S. 619, 627-28, 106 S.Ct. 2718, 91 L.Ed.2d 512 (1986), disciplining lawyers, Middlesex County Ethics Comm. v. Garden State Bar Ass'n, 457 U.S. 423, 432, 102 S.Ct. 2515, 73 L.Ed.2d 116 (1982), and abating nuisances. Huffman v. Pursue, Ltd., 420 U.S. 592, 604, 95 S.Ct. 1200, 43 L.Ed.2d 482 (1975). Civil commitment proceedings, often directed at sex offenders who have completed their prison sentences but are regarded as still dangerous, e.g., Kansas v. Hendricks, 521 U.S. 346, 117 S.Ct. 2072, 138 L.Ed.2d 501 (1997), are just as worthy of protection against being enjoined by federal judges as the other types of noncriminal proceeding to which Younger has been applied. Coley v. Clinton, 635 F.2d 1364, 1370-71 (8th Cir.1980); cf. Addington v. Texas, 441 U.S. 418, 426-28, 99 S.Ct. 1804, 60 L.Ed.2d 323 (1979).
It makes no difference that although the state proceeding is pending, the petitioner has exhausted the state remedies that he could invoke to block the proceeding by moving to dismiss it. If all a defendant in a state proceeding had to do in order to obtain federal court review of his federal claims before the proceeding was over was to move to dismiss and exhaust the remedies the state provided for a challenge to the denial of such a motion, Younger would be a dead letter. So the maneuver has been rejected, Neville v. Cavanagh, 611 F.2d 673, 675-76 (7th Cir. 1979); In re Justices of Superior Court, 218 F.3d 11, 17-19 (1st Cir.2000), and must be in this case as well.
What is true is that a person who is in state custody awaiting a determination by the state courts of the legality of his custody may seek federal habeas corpus to challenge that custody without being barred by the Younger doctrine if immediate federal intervention is necessary to prevent the challenge from becoming moot. That would be the case if the petitioner were complaining that the state proceeding had violated his right to a speedy trial or had placed him in double jeopardy. Braden v. 30th Judicial Circuit Court, 410 U.S. 484, 489-92, 93 S.Ct. 1123, 35 L.Ed.2d 443 (1973); Walck v. Edmondson, 472 F.3d 1227, 1232-34 (10th Cir.2007); Stringer v. Williams, 161 F.3d 259, 262 (5th Cir.1998). For then the eventual decision by the state court would come too late to secure his rights. That is not true of the petitioner's right not to be subjected to an ex post facto law.
The petitioner's request for a certificate of appealability is therefore
DENIED.
