                               In the

    United States Court of Appeals
                 For the Seventh Circuit
                     ____________________
No. 13-1833
WILLIAM L. AVILA,
                                                Petitioner-Appellant,

                                 v.

REED A. RICHARDSON,
                                               Respondent-Appellee.
                     ____________________

        Appeal from the United States District Court for the
                   Eastern District of Wisconsin.
      No. 12-C-228 — William E. Callahan, Jr., Magistrate Judge.
                     ____________________

       ARGUED APRIL 18, 2014 — DECIDED MAY 7, 2014
                     ____________________

   Before BAUER, EASTERBROOK, and HAMILTON, Circuit
Judges.
    HAMILTON, Circuit Judge. The Antiterrorism and Effective
Death Penalty Act of 1996 amended 28 U.S.C. § 2254(d) to
narrow the power of federal courts to grant habeas corpus
relief to state prisoners. Under that Act, the critical question
on the merits of most habeas corpus petitions shifted from
whether the petitioner was in custody in violation of the
Constitution, laws, or treaties of the United States to a much
2                                                     No. 13-1833

narrower question: whether the decision of the state court
keeping the petitioner in custody was “contrary to, or in-
volved an unreasonable application of, clearly established
Federal law, as determined by the Supreme Court of the
United States; or resulted in a decision that was based on an
unreasonable determination of the facts … .” 28 U.S.C.
§ 2254(d). This appeal from the denial of habeas corpus relief
presents a relatively rare case, one in which the state court
affirmed the petitioner’s conviction by applying a rule of law
directly contrary to controlling precedent of the Supreme
Court of the United States. We reverse the denial of relief
and remand for further proceedings in the district court, in-
cluding an evidentiary hearing on the petitioner’s claim.
    Petitioner William Avila pleaded guilty in Wisconsin
state court to one count of repeated sexual assault of a child,
as well as one count of producing child pornography and
sixteen counts of possessing it. See Wis. Stat. §§ 948.025,
948.05, 948.12. He was sentenced to a total of 35 years in
prison. The case is now before us on Avila’s petition for a
writ of habeas corpus. Among many other claims, he attacks
the voluntariness of his guilty plea on the ground that his
attorney told him he would receive just five years if he
pleaded guilty. The Wisconsin Court of Appeals concluded
that by pleading guilty, Avila had waived any challenge to
his counsel’s performance. The state court’s reasoning was
flatly contrary to Hill v. Lockhart, 474 U.S. 52, 56–57 (1985),
which held that a criminal defendant can challenge his
guilty plea if the plea itself was the result of ineffective assis-
tance of counsel. Because there has been no opportunity for
factual development of the issue, all we can say about the
merits of Avila’s claim at this point is that he is entitled to
make it.
No. 13-1833                                                   3

    The few facts before us can be summarized briefly. Avila
was accused of sexually assaulting an eight-year-old boy. He
told police that he had abused the boy more than twenty
times, including one instance when Avila had drugged and
raped him. A search of Avila’s computer revealed more than
a thousand images of child pornography along with a sex-
ually explicit video of his victim. Avila was charged with
sexually assaulting the child, producing child pornography
(which Wisconsin terms sexual exploitation of a child), and
48 counts of possessing child pornography, of which 32 were
dismissed in exchange for his guilty plea. At sentencing, the
state recommended 60 years in prison, the presentence re-
port recommended 31 to 38 years, and Avila’s attorney asked
for eight years. The judge imposed consecutive sentences of
20 years for sexual assault, ten years for sexual exploitation,
and five years for each of the possession charges, the last of
these to be served concurrently with one another. In addi-
tion, Avila was sentenced to 20 years of extended supervi-
sion after his release.
    Avila’s appellate counsel identified only frivolous
grounds for appeal and so submitted a no-merit report to the
Wisconsin Court of Appeals. See Wis. Stat. § 809.32; McCoy v.
Court of Appeals of Wisconsin, Dist. 1, 486 U.S. 429 (1988) (up-
holding procedure). Avila responded with a long list of ar-
guments. The only one relevant here is his claim that he re-
ceived ineffective assistance of counsel when his attorney
told him that if he pleaded guilty, he would receive just five
years of imprisonment and ten years of supervision. Avila
said he was never informed of the true severity of the sen-
tence he faced and he would have refused to plead guilty on
those terms.
4                                                   No. 13-1833

    The state appellate court adopted the reasoning of the
no-merit report and rejected the claims Avila raised in his
response. In the passage critical to this appeal, the court re-
jected Avila’s argument that he received ineffective assis-
tance in connection with the plea agreement: “Avila’s claims
that trial counsel performed deficiently before entry of the
guilty pleas were waived by his guilty pleas.” To support
this conclusion, the court cited State v. Lasky, 646 N.W.2d 53
(Wis. App. 2002), for the proposition that “a defendant’s val-
id guilty plea waives the right to raise nonjurisdictional de-
fects and defenses, including claimed violations of constitu-
tional rights.” The appellate court did not address the merits
of Avila’s claim. Avila sought review by the Wisconsin Su-
preme Court, which declined to hear his case. He then filed
in the district court a pro se petition for a writ of habeas cor-
pus under 28 U.S.C. § 2254.
    The district court denied Avila’s petition and denied him
a certificate of appealability as to any of the issues he raised.
With respect to the issue here, the court followed without
further analysis the state court’s conclusion that “Avila’s var-
ious claims that trial counsel performed deficiently before
entry of the guilty plea were waived by his guilty plea.” Avi-
la appealed from that decision, which we construed as a re-
quest for a certificate of appealability. See Fed. R. App.
P. 22(b)(2). A judge of this court granted the certificate as to
whether Avila had received ineffective assistance in pleading
guilty, citing Koons v. United States, 639 F.3d 348, 350–51 (7th
Cir. 2011), in which we noted that a habeas petitioner “can
challenge the validity of his guilty plea by demonstrating
that he received ineffective assistance from counsel during
the plea process.”
No. 13-1833                                                     5

     We review de novo the district court’s denial of Avila’s pe-
tition. Harris v. Hardy, 680 F.3d 942, 948 (7th Cir. 2012). We
may grant relief if the state court’s adjudication “resulted in
a decision that was contrary to, or involved an unreasonable
application of, clearly established Federal law, as determined
by the Supreme Court of the United States.” 28 U.S.C.
§ 2254(d)(1). A state court decision is contrary to clearly es-
tablished federal law if the court applies a rule that plainly
contradicts the Supreme Court’s governing rule or if it comes
to a result different than did the Supreme Court on substan-
tially identical facts. Williams v. Taylor, 529 U.S. 362, 405–06
(2000).
    The clearly established federal law applicable here is the
holding of Hill v. Lockhart that “the two-part Strickland v.
Washington test applies to challenges to guilty pleas based on
ineffective assistance of counsel.” 474 U.S. at 58, citing Strick-
land v. Washington, 466 U.S. 668 (1984). As explained in Hill, a
criminal defendant who pleads guilty on the advice of coun-
sel can challenge that plea as having not been made know-
ingly and voluntarily if his attorney’s representation fell be-
low an objectively reasonable standard. 474 U.S. at 56. The
defendant must also show “a reasonable probability that,
but for counsel’s errors, he would not have pleaded guilty.”
Id. at 59.
    That is the situation Avila has described in his response
to the no-merit brief and at every stage of review since then.
But rather than looking to Hill v. Lockhart, the state court ap-
plied the more general rule that a guilty plea waives non-
jurisdictional defects and defenses, including constitutional
claims, as explained in the case the state court cited, State v.
Lasky, 646 N.W.2d at 57; accord United States v. Villegas,
6                                                    No. 13-1833

388 F.3d 317, 322 (7th Cir. 2004). The exception recognized in
Hill for ineffective assistance in deciding to enter the plea,
however, is clearly established in both the federal and state
courts. See, e.g., Villegas, 388 F.3d at 322; Johnson v. Duck-
worth, 793 F.2d 898, 899 (7th Cir. 1986); State v. Kelty,
716 N.W.2d 886, 888–89 (Wis. 2006), citing State v. Bentley,
548 N.W.2d 50 (Wis. 1996). The state court’s conclusion that
Avila could not challenge his counsel’s performance after
pleading guilty cannot be reconciled with the Supreme
Court decision making clear that he could and thus was
“contrary to” clearly established federal law.
    The state suggests that we overlook the state court’s erro-
neous statement that Avila’s claims “were waived by his
guilty pleas,” characterizing it as a superfluous statement of
a general principle, a “fugitive sentence” in an otherwise
unobjectionable opinion that should be read to have implicit-
ly applied the correct rule of Strickland. A peculiarity of ha-
beas corpus jurisprudence is that if the state court had simp-
ly denied Avila’s claim without explanation, we would be
required to assume that the court had applied Strickland, and
we could grant relief only if the petitioner proved the nega-
tive by showing there was no reasonable basis for the result
reached by the state court. See Harrington v. Richter, 562 U.S.
—, —, 131 S. Ct. 770, 784 (2011); cf. Early v. Packer, 537 U.S. 3,
8 (2002) (state court need not cite or even know Supreme
Court cases so long as “neither the reasoning nor the result”
of its decision contradicts them). But here the state appellate
court did explain its reasoning. Because that reasoning con-
tradicted clearly established federal law as determined by
the Supreme Court, § 2254(d) is not a barrier to relief.
No. 13-1833                                                   7

    The existing factual record, however, is not adequate to
determine whether Avila’s counsel was actually ineffective
and, if so, whether Avila can show that but for the ineffective
assistance, he would have insisted on going to trial. See Hill,
474 U.S. at 58–59 (standard for relief); Mosley v. Atchison,
689 F.3d 838, 853 (7th Cir. 2012) (whether “the petitioner is
actually entitled to relief … is a separate question” from
whether the state court’s decision was contrary to federal
law). Avila therefore asks that we remand to the district
court for an evidentiary hearing.
    AEDPA forecloses federal-court fact-finding, except in
certain unusual circumstances not present here, if “the ap-
plicant has failed to develop the factual basis of a claim in
State court proceedings.” § 2254(e)(2). A “failure to develop
the factual basis of a claim is not established unless there is
lack of diligence, or some greater fault, attributable to the
prisoner or the prisoner’s counsel.” Williams, 529 U.S. at 432;
see also Davis v. Lambert, 388 F.3d 1052, 1060–61 (7th Cir.
2004). We see no such lack of diligence in this case. Avila has
consistently presented his claim at each stage of post-
conviction proceedings, without the benefit of counsel or the
opportunity to collect evidence.
    Because a hearing is not barred by § 2254(e), Avila is enti-
tled to an evidentiary hearing if he can satisfy the pre-
AEDPA standard. He must show “(1) the petitioner alleges
facts which, if proved, would entitle him to relief and (2) the
state courts, for reasons beyond the control of the petitioner,
never considered the claim in a full and fair hearing.” Davis,
388 F.3d at 1061. Avila has met the first requirement. He has
alleged that his attorney seriously understated the sentence
he faced and that he would have elected to face trial if better
8                                                 No. 13-1833

counseled. Those allegations, if proved, could warrant relief
under Hill. He has also satisfied the second requirement. For
reasons outside Avila’s control—namely, the legal error
about waiver—the state courts never gave his claim a full
and fair hearing. See id. at 1066.
    Because the state court’s finding of waiver was contrary
to clearly established Federal law as stated by the Supreme
Court of the United States and because Avila has otherwise
alleged a viable claim, he is entitled to develop that claim
through an evidentiary hearing in the district court. We
REVERSE the district court’s judgment denying of habeas
corpus relief and REMAND for an evidentiary hearing on
Avila’s claim of ineffective assistance in connection with his
guilty pleas.
