dissenting.
There is no doubt that Larry G. Smith committed a heinous crime when he decided to collect and trade child pornography. There is no doubt that the images contained on his computer were of the most horrific kind. There is no doubt that he is a very disturbed young man. Unfortunately, there is also no doubt that the district judge seriously misstated the law regarding the role of the Bureau of Prisons (“BOP”) in determining release dates for federal prisoners. The majority seems to agree that the district court’s “understanding” that the BOP had unfettered discretion to release prisoners early if BOP experts determined that the prisoner was cured is “incorrect.” Supra at 873-74. The majority finds that Smith has failed to demonstrate that the district court relied on this misunderstanding of the law in determining his sentence. I find it incomprehensible that such a misunderstanding could not influence a judge’s sentencing decision.
The original exchange, which came after defense counsel stated he would like to address the defense expert’s testimony, is worth repeating in its entirety:
THE COURT: You can address it. But like I said, I will go through it, but if you are going to address why you think Mr. Hundt is an expert, I want to know why he’s an expert, what he said, and how he drew the conclusion because there are a lot of comments that he made from a self-answered questionnaire by the defendant. And from that it appeared, at least — and I’m going back from recollection right now, that one diagnosed the problem which he may be able to do, psychologists do that to some degree, and then talks about his cure and everything else. I didn’t hear any expertise on that, whether or not prison is going to be good for him or bad for him, and whether or not he can be cured in prison.
Now, my experience from dealing with people that I have sent to institutions is that the institutions have experts in all these fields, and they determine whether people are treatable, how long they’re treatable, and if they’re cured, then they can — they can release somebody I had given *877life to at any time. I can’t make them hold onto a person. Once he hits the Bureau of Prisons, it’s up to the Bureau of Prisons how long they’re going to keep them up to the maximum that I give.
MR. FOSTER:1 I’m not following you, Judge. You sentence someone to X number of months to the Bureau of Prisons, with due respect, the Bureau of Prisons can’t jockey your sentence around.
THE COURT: I’m sorry, Mr. Foster. That’s not my understanding. I have had people that I’ve sent to prison for 30 years, and 8, 9, 10 years they release them be it overcrowding, be it whatever reasons they want. It’s under their jurisdiction.
Now, if I sentence somebody to 10 or 15 years, they can’t up it to 30 or 40 years. They don’t have that power, I don’t think.
MR. FOSTER: I have just never in the years I’ve practiced, never been fortunate enough to represent a person who was released early from a federal prison short of the 85 percent since we got rid of parole boards. I never saw it happen; never read a case citing that they had the authority to do that, but—
THE COURT: Mr. Foster, this is preguidelines. I think you were involved in a drug case that I had, the Bloom people.
MR. FOSTER: I remember that vaguely.
THE COURT: And several of those people received very, very heavy sentences, and they were released. Don’t get me wrong, it wasn’t they weren’t [sic] released in months, but they were released far before the time that, you know, I had sentenced them.
MR. FOSTER: And I do think that back there where we used to say a rule of thumb was one-third and where we still had parole boards, I think it was possible. But, boy, I think today they do 85 percent of what you give them minus a very— a lot of circumstance.
THE COURT: I lose track of them, Mr. Foster, after they leave my court, but my understanding is that the Bureau of Prisons have a lot of say. But that’s neither here nor there.
R. 116, at 37-39 (emphasis added).
Of course, as the majority and the government concede, the BOP does not “have a lot of say” in determining the release dates for federal prisoners. Rather, release dates are determined by statute. See 18 U.S.C. § 3624. Subsection (a) provides that “[a] prisoner shall be released by the Bureau of Prisons on the date of the expiration of the prisoner’s term of imprisonment, less any time credited toward the service of the prisoner’s sentence as provided in subsection (b).” Subsection (b) governs credit toward service of a sentence for “satisfactory behavior.” Under that provision, a prisoner who has displayed “exemplary compliance with institutional disciplinary regulations” may receive a credit of up to fifty-four days per year toward completion of the sentence. This amounts to a fifteen percent reduction for a prisoner who earns the full credit during each year of the term of imprisonment. Acknowledging the district court’s error, the government argues only that it was harmless. See Fed.R.Crim.P. 52(a) (“Any error, defect, irregularity, or variance that does not affect substantial rights must be *878disregarded.”). I do not believe such an error could be harmless.
There are two significant problems with the majority’s analysis of this issue. First, a district judge who believes the BOP can release a prisoner at any time, either because the prisoner has been cured or because the prison is overcrowded, mistakenly thinks he is sentencing a defendant to a term of up to twenty years rather than a straight twenty years. Any defendant can readily tell the difference between a fixed term of twenty years (minus fifteen percent for good behavior in the federal system) and a term of up to twenty years. Most prisoners would prefer the latter. If the judge did not understand that the defendant would serve at least seventeen of the twenty years, but instead thought that Smith could be released by the BOP as soon as he was cured, then the court did not understand the gravity of the sentence.
Second, because the court believed that BOP experts would determine when Smith could be safely released, it delegated to the BOP the court’s own responsibility for determining how dangerous Smith is and whether he could be rehabilitated. This mistaken belief also allowed the court to be dismissive of Smith’s proffered expert because the court assumed a BOP expert would “determine whether people are treatable, how long they’re treatable, and if they’re cured[.]” R. 116, at 38. With that assumption, a court would have no need to seriously consider the qualifications or testimony of the defendant’s expert on those issues. Mr. Hundt, Smith’s proffered expert, testified that he is a licensed clinical social worker and certified addictions counselor. He received his graduate degree from the University of Chicago, and has received additional training from the federal government in the treatment of sex offenders. He had been treating sex offenders for approximately ten years at the time of his testimony, mostly for the Department of Corrections in Indiana. Mr. Hundt also told the district judge that he often testifies in court, predominantly for the prosecutor’s office. These credentials are not easily dismissed, although the district court could, in its discretion, reject them as inadequate. But the court may not reject an expert because it mistakenly believes it can delegate to the BOP’s experts the task of assessing Smith’s potential for rehabilitation. As I read the sentencing transcript, it appears the district court relied at least in part on that mistaken belief.2
The majority states that the district court “expressly discounted the relevancy of the entire discussion of early release to sentencing, stating that it was ‘neither here nor there.’ ” Supra at 874-75. Why we should accept the district court’s blithe dismissal of the significance of its own error is mystifying. We have no obligation to defer to a district court making an error of law. United States v. Wesley, 422 F.3d 509, 512 (7th Cir.2005) (review of an underlying legal ruling is non-deferential).
The majority cites the district court’s later statement, “I don’t have any basis to say they’re going to let him out early,” *879supra at 874, as evidence that the court correctly understood the law relating to the BOP’s authority. See R. 116, at 93. But we must review this statement in the context of the entire colloquy. As quoted above, defense counsel attempted to correct the court’s error of law, noting that under current federal law, all defendants serve at least eighty-five percent of their sentences. R. 116, at 38-39. Attempting to repeat this correction of the law later, defense counsel said, “[Y]ou said maybe they’ll let him loose early. Judge, I don’t believe they will.” R. 116, at 93. The court then repeated its earlier error, countering with, “I said they could,” meaning the court believed that the BOP had the legal authority to release Smith early. R. 116, at 93. When the court followed this error with its statement that it did not “have any basis to say they’re going to let him out early,” the court clearly meant it had no factual basis to believe Smith would be released early; there was, after all, no way for the court to know whether the BOP would be able to treat Smith and declare him cured. R. 116, at 93. There is no evidence in this record that the court ever understood that the BOP has no legal authority to release Smith early.
The majority also states that “the fact that Smith could be released upon serving 85% of his sentence (the correct understanding of early release under current law) was mentioned several times during the sentencing hearings held thereafter[.]” Supra, at 874. The only references to the eighty-five percent figure that I could find in the record after the errors cited above were: (1) defense counsel’s statement that “[w]e can put him in there for 20 years, and at 85 percent we know they’ll turn him loose, and there’s a possibility you say of getting loose earlier.” R. 116, at 95; (2) government counsel’s statement that “[e]ven a maximum sentence of 20 years, which means that he would do 17 years of real time, gets him out when he’s 40.” R. 117, at 34; and (3) government counsel’s oblique reference that “[wje’re asking to impose lifetime supervised release given the fact that he’ll be 40 years old when he gets out[.j” R. 117, at 43.
The majority contends that, although there were several additional references to the correct understanding of early release, “nothing was said at the later sentencing hearings about the possibility of an earlier release for Smith if the BOP determined he was cured.” Supra, at 874. But none of those subsequent statements by counsel provide any evidence that the court understood that its original statement of the law was in error. Balanced against defense counsel’s attempts to clear up the issue (government counsel remained strangely silent as defense counsel attempted to correct the court’s error), we have an alarmingly confused statement from the court regarding the authority of the BOP to release prisoners early. The absence of any subsequent reference to the error during the final sentencing hearing did not cure the problem. I also see no need for “clairvoyance” (supra at 875) when common sense tells us that this is the kind of error that would pervade a judge’s decision-making process. Moreover, there is no special reason to require that the judge repeat the error at the final sentencing hearing before we treat it as a real error. An error is harmless if, considering the record as a whole, “the error did not affect the district court’s selection of the sentence imposed.” Williams v. United States, 503 U.S. 193, 203, 112 S.Ct. 1112, 117 L.Ed.2d 341 (1992). An error that changed the court’s basic framework for determining the sentence cannot be called harmless.
Finally, citing the Supreme Court’s opinion in Williams, the majority remarked that “Smith bears the burden of *880showing that the district court relied on the possibility of Smith’s early release pri- or to the 85% threshold when sentencing him.” Supra at 874 (emphasis in original). The Court’s full statement of the standard is instructive:
We conclude that the party challenging the sentence on appeal, although it bears the initial burden of showing that the district court relied upon an invalid factor at sentencing, does not have the additional burden of proving that the invalid factor was determinative in the sentencing decision. Rather, once the court of appeals has decided that the district court misapplied the Guidelines, a remand is appropriate unless the reviewing court concludes, on the record as a whole, that the error was harmless, i.e., that the error did not affect the district court’s selection of the sentence imposed. See Fed. Rule Crim. Proc. 52(a).
Williams, 503 U.S. at 203, 112 S.Ct. 1112.3 As I noted above, I believe Smith has met his burden of demonstrating that the district court relied on an invalid factor at sentencing. Smith does not bear “the additional burden of proving that the invalid factor was determinative in the sentencing decision.” Williams, 503 U.S. at 203, 112 S.Ct. 1112. In harmless error analysis, it is the government’s burden to prove that the error was not prejudicial. United States v. Mansoori, 480 F.3d 514, 523 (7th Cir.2007). The government has failed to meet that burden here.
The district court might well decide again to sentence Smith to a term of twenty years, and I do not mean to imply with my dissent that twenty years would not be a reasonable sentence. But even defendants who commit the most abhorrent crimes deserve a sentencing decision that is not influenced by legal errors if we are to maintain the rule of law.4 In light of the district court’s legal error, which went uncorrected by the court for the remainder of the sentencing hearing, I believe we should vacate the sentence and remand for a new sentencing. Therefore, I respectfully dissent.
. Mr. James Foster is Smith's appointed counsel.
. The majority correctly points out that Smith did not appeal the district court’s finding that Hundt's testimony was entitled to little weight. I address the effect of the court’s misunderstanding on the rejection of the expert to give context, to explain the possible wide-ranging effects of such a misapprehension, and because the government in its brief argues that the colloquy concerning the "side-issues” (specifically, the early release issue) was rendered "completely meaningless” once the court discounted the expert. To the contrary, the court’s dismissal of the expert was likely a side-effect of its misunderstanding about the role of the BOP in early release.
. Although the error in Smith’s case was one of law rather than the result of a misapplication of the guidelines, the standard for harmless error is the same.
. The majority assumes that I do "not mean to imply that all of the district court's sentencing decisions since the passage of the Sentencing Reform Act of 1984 were inappropriate.” I make no comment on cases that are not before us. I certainly hope the district court judge has not held this mistaken belief since the passage of that Act, and that this was a momentary lapse, a blip of memory or speech that affects even distinguished jurists from time to time. If we had remanded the case, the district judge might have clarified that he was referring only to pre-guidelines cases. We have only the transcript on which to rely at this stage, however, and the transcript twice indicates a mistaken belief that is never corrected.