GODBOLD, Chief Judge:
This habeas case presents an unusual situation. A prisoner is erroneously given a 20-year sentence when he should have been given a mandatory sentence of life or 99 years. His counsel, who is unaware that life or 99 years is mandatory, takes a “no merit” appeal, and the appellate court, on its own motion, vacates the 20-year sentence and orders that the prisoner be resen-tenced. The trial court then sentences him to life. We hold that the federal district court erred in denying the writ.
I. TRIAL, APPEAL AND RESENTENCE
Peoples, an Alabama state prisoner, was convicted May 21, 1981 of murder, pursuant to Alabama Code § 13A-6-2 (Suppl. 1977). The court continued the case for sentencing to June 12,1981, noting that the probation staff was not available. On June 12 Peoples was sentenced to 20 years. Immediately upon imposition of sentence trial counsel gave notice of appeal. Trial counsel withdrew and, on July 31, 1981, Donald Harrison was appointed for appeal. The trial transcript was not completed until March 5, 1982, and petitioner’s brief to the Alabama Court of Criminal Appeals was filed April 9, 1982. The only issues raised were sufficiency of the evidence and admissibility of a single piece of evidence, neither of which had been properly preserved at trial. The court, Peoples v. State, 415 So.2d 1230 (Ala.Crim.App.1982), summarily rejected both arguments on the ground nothing was presented to it for review and affirmed the guilt phase of the trial. Then, on its own motion, the court took up the matter of the sentence, an issue not raised by either party. It noted the requirements of the Alabama Habitual Felony Offender Act, Alabama Code § 13A-5-9(b)(3) (Supp. 1981), which provides:
(b) In all cases when it is shown that a criminal defendant has been previously convicted of any two felonies and after such convictions has committed another felony, he must be punished as follows: # # * * * *
(3) On conviction of a Class A felony, he must be punished by imprisonment for life or for any term of not less than 99 years.
Murder is a class A felony.
The court referred to prior caselaw holding that once a defendant admits prior felony convictions they are proved for purposes of the HFOA, and it noted that in his trial testimony Peoples had admitted to two prior felonies, grand larceny and a heroin drug charge. Having laid this predicate, the court remanded the case to the trial court with instructions to conduct a sentencing hearing and apply the HFOA.
On remand the trial judge resentenced Peoples to life. A transcript of the resen-tencing proceeding reveals that the following occurred. The state filed a motion with the trial court to invoke the HFOA and filed certified copies of two prior convictions. Peoples' counsel argued strenuously against resentencing. He noted that Peoples had testified at his trial and that the state had an opportunity to present evidence concerning his prior convictions but did not. Counsel argued that the trial court was in a better position to establish a sentence than an appellate court, and that the court of criminal appeals erred in reaching an issue not presented by either side. The trial judge responded that he was under “direct orders” of the court of criminal appeals to impose a sentence as directed by that court and, therefore, he imposed life imprisonment.
Pursuant to the mandate of the court of criminal appeals, a transcript of the resen-tencing proceedings was forwarded to it and the court affirmed. 421 So.2d 1383 (Ala.Crim.App.1982).
II. FIRST FEDERAL PETITION
In February 1983 Peoples filed a pro se habeas corpus petition in federal court. One of the grounds alleged was:
Change allegedly adding to punishment for prior offense. Increase in length of sentence.
In the supporting facts for this allegation Peoples alleged that he had been found guilty of second degree murder and sentenced to 20 years. He described the appeal to the court of criminal appeals, the remand, and the resentencing. He stated that on remand the court “changed the charge from second degree murder to first degree murder and also changed the sentence from 20 years to life imprisonment.” He alleged that because he testified at trial the trial court was fully aware of his prior record and at that time did not mention anything about the habitual offender law, and that he was not informed by the court or by his attorney prior to appealing the case that he could be resentenced under the habitual offender law. And he added, “If I had been inform of such ruling I probably wouldn’t have appeal this case.”
The state answered, admitting that the trial court was aware of the two priors when Peoples was originally sentenced, and that Peoples was not informed by the trial court or by his attorney when he gave notice of appeal that the case might or could be remanded for resentencing under HFOA. On the resentencing issue, the state responded that Peoples’ being resen-tenced under the mandatory provision of the HFOA did not violate his constitutional protections.
In a traverse to the state’s answer Peoples set out that the possibility of facing greater sentence should a retrial be ordered operates as an improper and unconstitutional deterrent to assertion of a defendant’s right to appeal.
The district court held
Petitioner’s resentencing was also not violative of the Constitution., It is well established that a sentence, which fails to comply with the criminal statute by which it is authorized, is erroneous and may be set aside on appeal or in habeas corpus proceedings. See, Bozza v. United States, 330 U.S. 160 [67 S.Ct. 645, 91 L.Ed. 818] (1947); In re Bonner, 151 U.S. 242 [14 S.Ct. 323, 38 L.Ed. 149] (1893). In Bonner, the Court rejected the idea that a prisoner, whose guilt is established by verdict, may escape punishment because the Court committed an error in passing the sentence. In this case, the trial court set aside the sentence which it had no authority to imp-rose and did what the law required it to do. See, In re Bonner, supra; see, also, United States v. DiFrancesco, 449 U.S. 117 [101 S.Ct. 426, 66 L.Ed.2d 328] (1980). Thus, Petitioner’s contention that he has been subjected to multiple punishment is without merit because the guarantee against multiple punishment is not involved here.
The court dismissed the petition. Peoples did not appeal.
III. FIRST STATE PETITION
Peoples repaired to the state court seeking collateral relief. In July 1983 he filed a coram nobis petition in the trial court. He alleged ineffectiveness of trial counsel, but none of the supporting allegations has any relation to the issue before us. Also he alleged ineffective assistance of counsel on appeal, with the following supporting allegation:
Counsel’s failure in his role as advocate was prejudicial to fundamental rights of petitioner.
Where, Mr. Don Harrison, appeal counsel for petitioner failed to consult with petitioner before he filed his brief to the court of criminal appeals was prejudicial to fundamental rights of petitioner.
The petition was denied without hearing in August 1983, and affirmed by the court of criminal appeals without opinion in November 1983, and certiorari was denied by the Alabama Supreme Court in December 1983.
IV. SECOND FEDERAL PETITION
The second federal petition was filed pro se in February 1984. It alleged ineffective assistance of trial counsel but did not raise effectiveness of appellate counsel. The state answered, referred to the prior federal petition, and alleged abuse of the writ.
The matter was assigned to a magistrate who issued an order to Peoples to show cause why the petition should not be dismissed pursuant to the state’s claim of abuse of the writ. Petitioner responded, denying abuse of the writ, and contending that when he filed his first federal petition he alleged all the grounds that were available to him and that the grounds in the second petition came from evidence newly discovered after he received a transcript from his attorney on September 1, 1983.
Peoples moved for appointment of counsel, and the motion was granted.
The magistrate conducted a hearing on the abuse of the writ issue and, after taking testimony, recommended that the motion to dismiss for abuse of the writ be denied. He found that, under the evidence, when Peoples filed his first federal petition he was not aware of the issues that he ultimately raised, primarily because he did not have a copy of the state court transcript, and, being a layman and not having a working knowledge of the law, he was not aware that he could raise an issue of ineffective assistance of counsel. Also the magistrate found that the state would not be prejudiced by allowing Peoples to proceed with his second petition. The state filed no objection to the recommendation of the magistrate that the motion to dismiss be denied, and the district court, noting the absence of objections, denied the motion.
With the abuse of the writ issue out of the way, the magistrate set the matter for evidentiary hearing on the merits. At the hearing, after dialogue with petitioner’s counsel, the magistrate described the issues to be heard and included “that appeal counsel was ineffective by taking an appeal when he knew of the possible implications of the Alabama Habitual Offender statute.” Thus the issue was before the district court.
Following the hearing the magistrate made these findings on this issue:
The evidence demonstrated that Mr. Harrison never imagined that there would be a risk of petitioner receiving a greater sentence simply because the conviction was appealed. The evidence demonstrated that Mr. Harrison believed that the trial court had discretion on whether or not to apply the Habitual Offender statute. Since the trial court mistakenly did not apply the new law at petitioner’s original sentencing hearing, and since the district attorney did not ask for it, Mr. Harrison believed in good faith that there was absolutely no risk of petitioner receiving a greater sentence than the one imposed by the trial court at the first sentencing hearing.
Also the magistrate quoted the order of the district court entered in the first federal proceeding, quoted above.
Finally, the magistrate found:
Mr. Harrison’s assistance was reasonable considering all the circumstances of this case. Mr. Harrison exercised reasonable professional judgment in pursuing an appeal of petitioner’s case. Mr. Harrison should not be adjudged ineffective simply because the trial court failed to mandatorily apply what, at the time, was a confusing law. The Magistrate finds that under the Strickland standard petitioner fails in all respects to meet his burden of establishing that his appellate counsel was ineffective.
Counsel for Peoples objected to the magistrate’s recommendations, asserting the following. The testimony of Harrison had brought out that the two issues he raised with the court of appeals were not preserved at trial for review, and he knew or should have known that the court could not act on those issues. Also Harrison had testified that he was not aware of the risk of petitioner’s receiving a greater sentence. In his objections petitioner called attention to Watson v. State, 392 So.2d 1274 (Ala.Crim.App.1980), which had held that provisions of the Habitual Offender Act are mandatory and not discretionary and that the use of the word “must” in the Act left no discretion with the trial court whether a repeat offender would be punished under the statute.
The district judge overruled Peoples’ objections and adopted the recommendations of the magistrate. The present appeal ensued.
On appeal the state does not question the conclusion of the magistrate, adopted by the district court, that there was no abuse of the writ, therefore we do not address it. This brings us, finally, to the merits.
Strickland v. Washington, 466 U.S. 668, 104 S.Ct. 2052, 80 L.Ed.2d 674 (1984), set forth a two-part test for determining whether the Constitution entitles defendant to relief. First, “the defendant must show that counsel’s representation fell below an objective standard of reasonableness.” Id. at 688, 104 S.Ct. at 2065, 80 L.Ed.2d at 693. In assessing counsel’s conduct against this standard a reviewing court must examine “the facts of the particular case, viewed as of the time of counsel’s conduct.” Id. at 690, 104 S.Ct. at 2066, 80 L.Ed.2d at 695. Second, the “defendant must show that there is a reasonable probability that, but for counsel’s unprofessional errors, the result of the proceeding would have been different.” Id. at 694, 104 S.Ct. at 2068, 80 L.Ed.2d at 698.
We hold that under this standard appellate counsel was ineffective. Watson had come down October 28, 1980, seven and one-half months before petitioner was first sentenced (June 1981) and 17 months before Harrison filed his appellate brief (in April 1982). The language of Watson is decisional:
The word, “must,” as it is used in [the HFOA], leaves no discretion with the court as to whether a repeat offender is to be punished under the statute.... [T]he increased punishment appellant received on his trial conviction became mandatory because of appellant’s status as a prior offender.”
392 So.2d at 1276, 77. This language leaves no doubt as to the mandatory nature of the HFOA.
The state, seeking to avoid the holding in Watson, says that the language of the court of criminal appeals, quoted above, is only addressed to the court, i.e., “the word ‘must’ [as used in the statute] leaves no discretion with the court_”, 392 So.2d at 1276 (emphasis added), and thus the prosecutor either had or thought he had discretion to invoke the act, and Harrison was entitled to draw the same conclusion and therefore was not ineffective in exposing his client to the risks of further litigation. But the opening sentence of the court’s holding in Watson says: “The provisions of the Habitual Offender Statute are mandatory and not discretionary....” And the conclusion of the discussion, at p. 1277, reiterates the mandatory nature of the statute.
Moreover, in another case decided before petitioner was sentenced, the court of criminal appeals reiterated the mandatory nature of the HFOA. Holley v. State, 897 So.2d 211, 215 (Ala.Crim.Appeal 1981). In other cases decided after petitioner was sentenced but before Harrison filed his brief in the court of criminal appeals the message of Watson was restated. Aplin v. State, 421 So.2d 1299 (Ala.Crim.Appeals 1981).
The state also argues that it was uncertain whether a drug offense, such as Peoples had, could be counted as one of the two priors. This had been answered in Motley v. State, 409 So.2d 945 (Ala.Crim. Appeals 1981), decided four and one-half months before Harrison filed his brief. Smith v. State, 409 So.2d 455 (Ala.Crim.App.1981), decided more than four months before Harrison filed his brief, held that a defendant's own testimony could be used to prove prior felonies under the HFOA. Thus, the state’s contention that Harrison could not have known that Peoples’ own testimony provided the requisite proof of prior felonies lacks merit.
In summary, well before Harrison filed his brief in the court of criminal appeals it was settled law that the HFOA was mandatory, that Peoples’ drug conviction counted as a prior, and that Peoples’ own testimony admitting the priors was sufficient proof of their existence. Thus Peoples’ case was not a case of first impression with respect to the mandatory nature of the HFOA or with respect to his eligibility for it or the nature of proof at trial.
Appellate counsel did not know that of its own motion the court of appeals would take note of the failure of the trial court to follow the HFOA and vacate the sentence and remand the case for the statute to be applied. But the concern is not that counsel did not advise Peoples in sure and certain terms what the court of appeals would do, for he could not know that. But counsel was bound to consider himself, and to advise his client, of the risks that the appeal presented. Repeatedly the court of criminal appeals had said previously that application of the HFOA was required. At least there was substantial risk that the court would treat the statute as mandatory, as it had characterized it, and implement the mandatory application of it. There was little on the other side of the scales — two issues not even preserved for appellate review. Peoples was entitled to decide whether to take his chances on appeal with as good knowledge as was reasonably available of what the stakes were — that if he proceeded with the hopeless merits appeal he might, just might, end up with 99 years or life instead of 20. He never knew the risks. And he ended up with life. Under these facts, Harrison’s representation of Peoples falls below the objective standard of reasonableness that the constitution mandates.
Peoples has established sufficient prejudice from his counsel’s unreasonable actions to entitle him to relief. Both Peoples and Harrison agree that had they been aware of what the stakes were there would have been no appeal. Thus counsel’s actions led Peoples to take an appeal that subjected him to the risk that his sentence would be increased from 20 years to life, and that risk came to fruition. This satisfies the prejudice test of Washington.
The state suggests that prejudice has not been shown because even if Harrison had been aware of the risks to his client the matter was beyond salvation because notice of appeal had been filed before he was appointed and the court of appeals might not have permitted him to dismiss the appeal. This is pure speculation and is simply out of keeping with the way appellate courts in general proceed. The transcript was not filed until March 1982, and until that time it was unlikely that the court of criminal appeals would have been aware of the discrepancy in sentence. Peoples is entitled to a writ of habeas corpus.
REVERSED and the case REMANDED to the district court for the issuance of a writ vacating Peoples’ life sentence.
. The court of criminal appeals followed the same approach in later cases, e.g., Chambers v. State, 418 So.2d 948 (Ala.Crim.App.1982); Coleman v. State, 424 So.2d 685 (Ala.Crim.App.1982).
. This issue is out of the case. Degrees of murder had been abolished in Alabama when Peoples was tried. Hill v. State, 409 So.2d 943 (Ala.Crim.App.1981).
. The state did not raise failure to exhaust state remedies, therefore it was waived. Byrd v. Wainwright, 722 F.2d 716, 718 n. 3 (11th Cir. 1983), cert. denied, — U.S. —, 105 S.Ct. 217, 83 L.Ed.2d 147 (1984); Lamb v. Jernigan, 683 F.2d 1332, 1335 n. 1 (11th Cir.1982), cert. denied, 460 U.S. 1024, 103 S.Ct. 1276, 75 L.Ed.2d 496 (1983).
. It did not allege that Peoples’ resentencing violated the double jeopardy clause, but the magistrate raised this issue and decided that the procedures followed were constitutionally permissible. Peoples raises this issue on appeal, but because of our disposition on the ineffective assistance of appellate counsel claim, we need not address it.
. The statutory mandate, as applied to Watson, involved § 9(c)(1) because he had more than three priors and was convicted of a Class C felony, thus the court could assess life or 15 to 99 years
Petitioner falls under 9(b)(3) because he had two priors and was convicted of a Class A felony, which required a sentence of life or not less than 99 years.
. The state urges that the absence of an election by the prosecutor to trigger the HFOA was not settled until Aplin. Even if this was so it would not aid the state, since Aplin was decided four and one-half months before Harrison filed his brief.