PER CURIAM.
Monte Dochterman pleaded guilty to one count of bank robbery and was given the maximum sentence of twenty years and committed for study pursuant to 18 U.S.C. § 4205(c) (1976). After completion of the study, the court reduced his sentence to eight years. On April 6, 1979, Dochterman filed a section 2255 motion alleging that his attorney and the prosecuting attorney coerced him into pleading guilty. 28 U.S.C. § 2255 (1976). The court referred the case to a magistrate, who, after a hearing, recommended that the petition be denied. The district court, adopting the magistrate’s recommendation, dismissed the action. We affirm.
Dochterman’s claim of coercion stems from events following the trial court’s rejection of a plea agreement between the prosecutor and defendant. The Government agreed to move to dismiss count I and recommend a three-year sentence under the Youth Corrections Act in exchange for Dochterman’s agreeing to plead guilty to count II of the indictment. The court, however, refused to accept the plea bargain, stating:
* * * The Court has examined the presentence report on this defendant and is of the view that because of the matters in the report that this defendant is not a fit subject for sentencing under the Youth Corrections Act, and therefore, I reject the plea bargain.
The court called a recess to give Dochterman time to consider withdrawing his guilty plea. At the hearing on his section 2255 motion, Dochterman testified that his attorney and the prosecuting attorney both assured him during the recess that the court would, in the end, impose the bargained-for three-year sentence, and was only trying to “put the fear of God in him.” Dochterman’s brother and mother corroborated this testimony in part. Dochterman also testified that his attorney assured him prior to resentencing that the court would impose the three-year sentence.
Dochterman now alleges that he pleaded guilty in reliance on the representations of his attorney and the attorney for the Government, and that these false representations coerced him into pleading guilty.
The Government and Dochterman’s attorney, Robinson, strongly disputed Dochterman’s testimony. Robinson testified that he advised Dochterman to plead guilty, but at no time did he guarantee that the court would impose only a three-year sentence. He said that he made it clear that the court would not sentence Dochterman according to the plea bargain. Finally, Robinson testified that before Dochterman was resentenced, Robinson expressed the hope that, since Dochterman had behaved well during the ninety-day study period, the court might reduce his sentence to ten years.
The magistrate credited Robinson’s testimony over the testimony of Dochterman, his mother, and his brother. The magistrate rejected Dochterman’s testimony because: 1) Dochterman had earlier filed several petitions for postconviction relief in which he referred to the original plea bargain but failed to claim coercion or reliance on unkept promises; 2) Dochterman indicated, in letters written to Robinson during the ninety-day study period that he knew the court had a wide choice of sentencing options available; and 3) Dochterman’s only corroboration was the testimony of his mother, whose credibility was weakened because of her relationship with Dochterman and her inability to remember details.
The district court’s findings of fact will not be overturned on appeal unless clearly erroneous. Fed.R.Civ.P. 52(a); Merrill Lynch, Pierce, Fenner & Smith, Inc. v. Goldman, 593 F.2d 129, 131 (8th Cir.), cert. denied, 444 U.S. 838, 100 S.Ct. 76, 62 L.Ed.2d 50 (1979). The court is especially reluctant to set aside findings where-as in this case-those findings rest primarily on the judge’s assessment of the credibility of the witnesses. As we stated in Merrill Lynch, Pierce, Fenner & Smith, Inc. v. Goldman, supra, 593 F.2d at 131-32,
[w]e note that “it is not the function of an appellate court to try the case de novo, or to pass upon the credibility of witnesses or the weight to be given their testimony * * *." Shull v. Dain, Kalman & Quail, Inc., 561 F.2d 152, 155 (8th Cir. 1977), cert. denied, 434 U.S. 1086, 98 S.Ct. 1281, 55 L.Ed.2d 792 (1978). This is especially true where the case is primarily based upon oral testimony and where the trial judge has had an opportunity to view the demeanor and credibility of the witnesses. E.g., Snodgrass v. Nelson, 503 F.2d 94, 96 (8th Cir. 1974).
Findings of fact are clearly erroneous if they are unsupported by substantial evidence, or if the reviewing court is left with the conviction that a mistake has been made. Automated Controls, Inc. v. MIC Enterprises, 599 F.2d 288, 289 (8th Cir. 1979) (per curiam); Merrill Lynch, Pierce, Fenner & Smith, Inc. v. Goldman, supra, 593 F.2d at 131. In light of the testimony of Robinson and the government attorney, and supporting exhibits, we cannot say that the district court’s findings of fact were clearly erroneous.
Judgment affirmed.
. This recommendation was based on the strength of the Government’s case against him and on the fact that Dochterman faced numerous state charges, all of which would be dropped if Dochterman pleaded guilty.
. The magistrate discounted Dochterman’s brother’s testimony because he did not directly hear the discussion between Dochterman and Robinson.