James L. Anzalone appeals the forty-six month sentence he received after pleading guilty to a cocaine distribution conspiracy offense. He contends the district court erred *941in denying his motion to compel the government to file a substantial assistance downward departure motion under U.S.S.G. § 5K1.1. Because the government’s refusal to file the motion was for reasons other than the nature of Anzalone’s substantial assistance, we reverse.
Anzalone’s plea agreement provided that he would truthfully cooperate with the United States Attorney and that “[a]ny cooperation provided by you will be considered by the government under Sentencing Guidelines § 5K1.1____” This language preserved the government’s discretion to decide whether to file a substantial assistance downward departure motion. See United States v. Barresse, 115 F.3d 610, 612 (8th Cir.1997). In such cases:
the court is without authority to grant a downward departure for substantial assistance absent a government motion. See Wade v. United States, 504 U.S. 181, 112 S.Ct. 1840, 1843-44, 118 L.Ed.2d 524 (1992). Some limited exceptions to this rule exist, providing that, relief may be granted absent a government substantial assistance motion if a defendant shows that the government’s refusal to make the motion was based on an unconstitutional motive, that the refusal was irrational, or that the motion was withheld in bad faith. See Wade, 112 S.Ct. at 1844. However, a defendant is not even entitled to discovery or a hearing on such allegations until the defendant makes a “substantial threshold showing.” Wade, 112 S.Ct. at 1844.
United States v. Kelly, 18 F.3d 612, 617-18 (8th Cir.1994) (citations other than Wade omitted); see United States v. Hammer, 3 F.3d 266, 271 (8th Cir.1993), cert. denied, 510 U.S. 1139, 114 S.Ct. 1121, 127 L.Ed.2d 430 (1994).
Anzalone provided assistance, but the government declined to file a § 5K1.1 motion. Anzalone moved to compel its filing. When the district court took up that motion at the sentencing hearing, the government “agree[d] that [Anzalone] could make a substantial threshold showing that he- has substantially assisted” the government’s investigation and prosecution of other members of the cocaine distribution conspiracy. However, the government advised that it would not file a § 5K1.1 substantial assistance motion because it received information that Anzalone had recently used and possessed controlled substances, thereby violating a provision in his plea agreement: “You shall not commit any additional crimes whatsoever.” Concluding that the government’s position was rational, the district court denied Anzalone’s motion to compel and sentenced him without a downward departure.
On appeal, the parties primarily debate whether the government’s decision was irrational because it was based, at least in part, on Aizalone’s failure to pass a polygraph test addressing whether he had used and possessed controlled substances. We conclude there is a more fundamental defect in the government's position. Its refusal to file a substantial assistance motion was based entirely upon a reason unrelated to the quality of Anzalone’s assistance in investigating and prosecuting other offenders. But § 5K1.1 and the related statute governing mandatory minimum sentences, 18 U.S.C. § 3553(e), do not grant prosecutors a general power to control the length of sentences. Because sentencing is “primarily a judicial function,” Mistretta v. United States, 488 U.S. 361, 390, 109 S.Ct. 647, 102 L.Ed.2d 714 (1989), the prosecutor’s virtually unfettered discretion under § 5K1.1 is limited to the substantial assistance issue, which is a question best left to the discretion of the law enforcement officials receiving that assistance. “The desire to dictate the length of a defendant’s sentence for reasons other than his or her substantial assistance is not a permissible basis for exercising the government’s power under § 3553(e) [or § 5K1.1].” United States v. Stockdall, 45 F.3d 1257, 1261 (8th Cir.1995).
Therefore, “the government cannot base its [§ 5K1.1 motion] decision on factors other than the substantial assistance provided by the defendant.” United States v. Rounsavall 128 F.3d 665, 669 (8th Cir.1997). Once the government concludes that a defendant has provided substantial assistance, and has positively assessed in that regard “the cost and benefit that would flow from moving,” Wade, 112 S.Ct. at 1844, it should make the downward departure motion and then *942advise the sentencing court if there are unrelated factors, such as Anzalone’s alleged post-plea agreement drug use, that in the government’s view should preclude or severely restrict any downward departure relief. The district court may of course weigh such alleged conduct in exercising its downward departure discretion. See United States v. Casiano, 113 F.3d 420, 428-30 (3d Cir.), cert. denied, — U.S. -, 118 S.Ct. 221, 139 L.Ed.2d 155 (1997); United States v. Luiz, 102 F.3d 466, 469-70 (11th Cir.1996).1
Judge Murphy in dissent concludes that the government properly refused to file a § 5K1.1 motion because paragraph 8 of the plea agreement provides that, if Anzalone breaches that agreement, for example by committing additional drug offenses, the government may “refuse to make a motion or recommendation ... which it is otherwise bound by this agreement to make regarding sentencing.” We disagree. Paragraph 8 by its plain language does not apply to a substantial assistance downward departure motion, because the government was never “bound” to make such a motion. The government merely agreed in paragraph 5.B. that “[a]ny cooperation provided by you will be considered by the government under Sentencing Guideline § 5K1.1.” Thus, we need not consider an additional issue raised by the dissent’s analysis — whether the government may by agreement with a defendant expand its sentencing authority vis-a-vis the sentencing court. Cf. U.S.S.G. Ch. 6, Pt. B, intro, comment, (“sentencing is a judicial function and ... the appropriate sentence in a guilty plea case is to be determined by the judge”).
For the foregoing reasons, the judgment of the district court is reversed and the case is remanded for further sentencing proceedings not inconsistent with this opinion. We note the government has not conceded that Anza-lone provided substantial assistance, only that he could make an adequate threshold showing of substantial assistance.
. In confirming this rule, we do not impose upon the government a general duty to disclose its reasons for not filing a substantial assistance motion, nor do we lighten the defendant’s burden to make a "substantial threshold showing” of improper motive. In this case, the government conceded prior to Anzalone making that showing that its decision not to file the motion was based entirely on a factor unrelated to his substantial assistance.