
261 N.W.2d 899 (1978)
STATE of North Dakota, Plaintiff and Appellee,
v.
Michael THORSTAD, Defendant and Appellant.
Crim. No. 599.
Supreme Court of North Dakota.
January 19, 1978.
Rehearing Denied February 2, 1978.
*900 Donald L. Jorgensen, Asst. State's Atty., Dickinson, for plaintiff and appellee.
Lundberg, Conmy, Nodland, Rosenberg, Lucas & Schulz, Bismarck, for defendant and appellant; argued by Irvin B. Nodland, Bismarck.
SAND, Justice.
Michael Thorstad, the defendant, appealed from a Stark County district court order revoking his probation and from the judgment imposing sentence.
The basic criminal proceedings charged the defendant with one count of breaking into a vehicle and one count of theft. The district court appointed counsel for defendant. The case came on for trial, and shortly thereafter, on 26 February 1976, a plea bargain agreement was reached between the prosecutor and the defendant through his counsel. The relevant provisions of the plea bargain agreement were that the imposition of sentence would be deferred provided the defendant, within one year, paid the damages caused by the break-in, to the owner of the vehicle, or paid the insurance company if it had paid for the repairs, and reimbursed Stark County the moneys it expended for his court-appointed counsel. The plea bargain agreement was submitted to, approved and accepted by the court, whereupon the defendant pleaded guilty.
The following unrelated incidents took place: On 3 March 1976 the defendant appeared before the county court on a driving-while-intoxicated charge, was found guilty, and was sentenced to 30 days in the State Farm. On another unrelated matter he was also sentenced to an additional 160-day term in the State Farm for a parole violation. As a result, the defendant spent the period from 3 March 1976 to 23 July 1976 in the State Farm. On 10 December 1976 a petition to revoke Thorstad's probation was filed with the court alleging that Thorstad was in possession of stolen property in violation of a previous probation order. A hearing on the revocation petition was held on 15 December 1976, and the court found that Thorstad violated his probation by knowingly and voluntarily being in possession of stolen property. The court revoked the previous order deferring imposition of sentence and issued a new order again deferring imposition of sentence, which order incorporated the condition of restitution and reparation stated in the 26 February 1976 order.
Another petition dated 17 March 1976 to revoke defendant's (26 February 1976) probation was filed with the court, alleging Thorstad violated his probation by failing to pay the replacement costs of the window (damages) to the owner of the vehicle and by failing to reimburse Stark County for money expended for his court-appointed attorney, on or before 25 February 1976 as provided for in the deferred imposition of sentence order. After a hearing, the court revoked the probation and sentenced the defendant to two years in the State Penitentiary, suspending the second full year upon the condition that within one year of the defendant's release from the State Penitentiary he make reparation to the owner of the vehicle or to the insurance company for damages (broken window), and reimburse Stark County for all court costs and attorney fees incurred and paid as a result of the defendant's criminal activity.
Thorstad appealed and contended: (1) that the trial court violated his constitutional right under the Due Process and the Equal Protection Clauses of the Fourteenth Amendment of the United States Constitution when it made restitution and reparation a condition of parole without first having a hearing pursuant to § 12.1-32-08, North Dakota Century Code, and subsequently revoked his parole because restitution and reparation were not made within the time specified; and (2) that the evidence of the violation of the condition of probation was insufficient to sustain a revocation because the State did not establish by a preponderance of the evidence that the *901 defendant intended to violate the condition of probation or that the defendant had the ability to pay.
We will first consider whether or not a restitution or reparation hearing as contended by Thorstad was required.
Section 12.1-32-08, NDCC, provides as follows:
"Prior to imposing restitution or reparation as a sentence or condition of probation, the court shall hold a hearing on the matter with notice to the prosecuting attorney and to the defendant as to the nature and amount thereof...."
It then sets forth the various determinations the court is required to make.
After serious deliberation, we conclude that the provisions of § 12.1-32-08, NDCC, apply in situations where the defendant either is found guilty or pleaded guilty to a criminal charge and the amounts or the issues of restitution or reparation are uncertain or are in dispute. However, we do not believe it applies where restitution or reparation was resolved by agreement with the defendant through plea-bargaining procedures even though the specific amount is not known and is to be determined later. When a defendant agrees to pay for the damage he caused and has a general idea of the amount, but not the specific amount in dollars and cents, which is to be determined later, he cannot later claim in the absence of fraud, that he was not made aware of the amount or that he did not agree to the amount.
After a voluntary agreement has been reached on the issues of restitution and reparation it would be a useless gesture to proceed under § 12.1-32-08, NDCC.
We do not believe that justice requires the performance of an idle act (§ 31-11-05(23), NDCC), which it would be to require a restitution or reparation hearing after the defendant has agreed to make restitution or reparation, as the case may be. Neither can we conclude that restitution or reparation may be a condition of parole or probation only after a hearing has been held pursuant to § 12.1-32-08, NDCC, if the conditions were agreed to by defendant as a result of plea bargaining.
In State v. Spiekermeier, 256 N.W.2d 877 (N.D.1977), no hearing was held pursuant to § 12.1-32-08, NDCC, and on appeal the case was remanded for such hearing. However, in Spiekermeier not only was the amount of restitution in dispute but also whether or not the damages to a vehicle were caused by or resulted from the defendant's violations of law so as to bring the damages within the restitution or reparation provision. In the instant case, there was an agreement acknowledging and identifying the damages, with the specific dollars and cents to be determined later by consulting certain persons or officials.
Plea bargaining in some form, either in the open or under obscure circumstances, has been a part of the criminal process for many years, and has been legitimatized in recent years by a number of States and the United States Government.
North Dakota, in 1973, began treating plea bargaining realistically by adopting Rule 11, North Dakota Rules of Criminal Procedure, in which plea bargaining is officially recognized and regulated.
The United States Supreme Court in Santobello v. New York, 404 U.S. 257, 260, 261, 92 S.Ct. 495, 498, 30 L.Ed.2d 427 (1971), with reference to plea bargaining, said:
"The disposition of criminal charges by agreement between the prosecutor and the accused, sometimes loosely called `plea bargaining,' is an essential component of the administration of justice. Properly administered, it is to be encouraged. If every criminal charge were subjected to a full-scale trial, the States and the Federal Government would need to multiply by many times the number of judges and court facilities.
"Disposition of charges after plea discussions is not only an essential part of the process but a highly desirable part for many reasons. It leads to prompt and largely final disposition of most criminal cases; it avoids much of the corrosive impact of enforced idleness during pretrial confinement for those who are denied *902 release pending trial; it protects the public from those accused persons who are prone to continue criminal conduct even while on pretrial release; and, by shortening the time between charge and disposition, it enhances whatever may be the rehabilitative prospects of the guilty when they are ultimately imprisoned. See Brady v. United States, 397 U.S. 742, 751-752, 90 S.Ct. 1463, 25 L.Ed.2d 747, 758 (1970).
"However, all of these considerations presuppose fairness in securing agreement between an accused and a prosecutor. It is now clear, for example, that the accused pleading guilty must be counseled, absent a waiver. [Citation omitted.] Fed. Rule Crim.Proc. 11, governing pleas in federal courts, now makes clear that the sentencing judge must develop, on the record, the factual basis for the plea, as, for example, by having the accused described the conduct that gave rise to the charge. The plea must, of course, be voluntary and knowing and if it was induced by promises, the essence of those promises must in some way be made known."
In Bryan v. United States, 492 F.2d 775, 781 (5th Cir. 1974), cert. denied 419 U.S. 1079, 95 S.Ct. 668, 42 L.Ed.2d 674 (1974), reh. denied 419 U.S. 1117, 95 S.Ct. 798, 42 L.Ed.2d 817 (1975), the Court said that at the time of accepting pleas of guilty:
"The court shall state that plea agreements are permissible and that the defendant and all counsel have a duty to disclose the existence and details of any agreement which relates to the plea tendered. Specific inquiry shall be made as to the existence of such an agreement before a plea is accepted. The defendant shall be placed under oath. These are minimum practices and are not intended to circumscribe any additional procedures or inquiries deemed by any court to be pertinent to the issue of plea propriety in any case."
In Johnson v. Beto, 466 F.2d 478, 480 (5th Cir. 1972), the Court noted some contract elements in plea bargaining:
"Plea bargaining is an accepted folkway of our criminal jurisprudence onto which some, but not all, contract criteria have been superimposed. Analogous to promissory estoppel, plea bargaining must have more substantiality than mere expectation and hope. It must have explicit expression and reliance and is measured by objective, not subjective, standards. All of the elements of the plea bargain were found here, and the law gives its sanction to such bargains when they are real and not mere figments."
The defendant's contention, if adopted, would in effect drastically curtail, if not eliminate, plea bargaining and would void Rule 11, NDRCrimP, and put plea bargaining back in the obscure and questionable pre-rule status.
Plea bargaining has been officially accepted in North Dakota, and as stated in Beto, supra, contract criteria have been superimposed upon it. This gives the courts justification to treat court-approved plea bargain agreements similarly to contracts. The plea bargaining process is designed to and does facilitate the criminal justice process.
No legal reason has been presented, and we are not aware of any, why we should reject plea bargaining, or that it is merely an additional procedural step.
The defendant, in support of his argument, also refers to § 12.1-32-07(2)(e), NDCC, contending it applies to the instant case. It provides:
"When imposing a sentence to probation, the court may impose such conditions as it deems appropriate, and may include any one or more of the following:
. . . . .
e. Make restitution or reparation to the victim of his conduct for the damage or injury which was sustained, or perform other reasonable assigned work. When restitution, reparation, or assigned work is a condition of the sentence, the court shall proceed as provided in section 12.1-32-08."
*903 However, we are involved in the instant case with a deferred imposition and not the imposition of sentence to probation.
We are satisfied that § 12.1-32-07(2)(e), NDCC, does not apply to the instant case for the reasons given earlier explaining that § 12.1-32-08 does not apply in those instances where the restitution or reparation is the result of a plea-bargaining agreement between the State and the defendant.
We further note that § 12.1-32-07, NDCC, refers to "imposing a sentence to probation" and not to a deferred imposition of sentence as we have in this case. But we do not find it necessary to construe these phrases because we do not base our conclusion on this difference.
However, as to deferred imposition of sentence, § 12-53-13, NDCC, has application. It provides, as is pertinent to the situation here, that:
"... the court ... upon application or its own motion may, in its discretion, suspend the imposing of the sentence and may direct that such suspension continue for a definite period of time, upon such terms and conditions as it may determine."
The defendant does not contend, nor does the record suggest, that the trial court abused its discretion when it imposed the condition for deferring the imposition of sentence.
The defendant also made reference to Fuller v. Oregon, 417 U.S. 40, 94 S.Ct. 2116, 40 L.Ed.2d 642 (1974), in which the United States Supreme Court discussed the basic requirements of a restitution statute and approved the Oregon statute. He contended that the North Dakota statutes pertaining to reimbursement to the county for fees and expenses of the court-appointed attorney were too vague and do not meet the standards of the Oregon statute which was approved by the Supreme Court.
We do not believe that Thorstad is in a position, factually or legally, to challenge any of the statutes pertaining to the reimbursement for attorney fees and expenses because he voluntarily agreed through plea bargaining to reimburse Stark County for attorney fees. In State v. Woodworth, 234 N.W.2d 243 (N.D.1975), we said that the defendant may challenge the statute only as it applies to him under the facts. See also, State v. Watson, 231 N.W.2d 839 (S.D.1975); Big Eagle v. Andera, 508 F.2d 1293 (8th Cir. 1975); and City of Bismarck v. Materi, 177 N.W.2d 530 (N.D.1970), which held that a litigant may assert only his own constitutional rights or immunities unless there are weighty countervailing policies. If there are any countervailing policies involved, none has been presented by the defendant.
Because the defendant agreed through the plea bargaining process to reimburse Stark County for attorney fees and attorney expenses we do not believe the defendant is in a position to challenge any of the statutes relating to the recoupment of attorney fees and expenses. The plea agreement was reached between the defendant and the prosecutor and submitted to the court for approval. The court approved it. The defendant is now not in a position to challenge the validity of such agreement.
At the hearing where the plea agreement was approved and the probation conditions set out, the defendant's attorney stated to the court:
"Yes, Your Honor. We have entered into negotiations with the State's Attorney's office, and we have just discussed the plea and we would like to present it to the Court at this time.
"The plea would be a one year deferred imposition of sentence, under it my client would be put under the supervision and control of the Parole Board of Probation 
"THE COURT: North Dakota Parole Board.
"MR. REICHERT: He will be subject to the restrictions of the search and seizure, and must pay the County his court-appointed attorney's fees within one year. He will not violate any of the laws or ordinances. I want to bring to the Court's attention that there is a pending DWI charge in County Court of Increased Jurisdiction at this time.

*904 "And there is nothing else, is there, Mike?
"THE DEFENDANT THORSTAD: No.
"MR. REICHERT: The defendant has no criminal record, and I believe there are a couple other conditions. I can't remember them.
"THE COURT: Did anybody discuss restitution? None of the stolen property has failed to have been recovered? It would be the cost of the window.
"MR. JORGENSON: Did we discuss
"MR. REICHERT: No, we didn't discuss that. Mike, what about that?
"THE DEFENDANT THORSTAD: What's that? The cost of the window in the car?
"MR. REICHERT: I don't know how much it would be. It would be the back rear window, and that would be split. Two hundred dollars, or so? Are you agreeable to that?
"THE DEFENDANT THORSTAD: To what? Paying?
"MR. REICHERT: Within a certain period of time.
"THE DEFENDANT THORSTAD: Depending how long I would have to pay it.
"MR. REICHERT: One year.
"THE DEFENDANT THORSTAD: Okay."
The court then advised the defendant of his constitutional rights in detail, after which defendant pleaded guilty and accepted the conditions.
The defendant's inability to reimburse Stark County for the attorney fees it expended for his court-appointed attorney and to make restitution for the damage to the car never became a relevant issue for several reasons. At the revocation hearing, 30 March 1977, the defendant testified that he went to the State's Attorney's office to find out exactly how much the window which was to be replaced in the car cost and how much the attorney fees were. The State's Attorney was not in his office and on the suggestion of the State's Attorney's secretary he went to the Clerk of Court's office where he was told to see his attorney. He went to his former attorney who inquired of the defendant if the district court had revoked his suspension. The defendant replied, yes, that the court did; whereupon his former attorney advised him he did not have to pay because the suspension was being revoked.[1]
The defendant also testified that he had the money and was going to get a loan from his brother to pay off the entire amount, but did not, upon advice of his former attorney. Nowhere during the revocation hearing or at any other time did the defendant state to the court that he did not pay because of his inability, but rather that he did not pay because the attorney advised him not to on the grounds that the suspension or deferred imposition (and parole) was revoked. Specifically, his attorney asked:
"And is it my understanding that had you not talked to [your former attorney] you would have made arrangements to pay the amount due?
"A. Yes; I would have."
A discussion regarding the testimony of the former attorney took place between the court and the defendant's second attorney, whereupon the court advised that it was going on the assumption that what the defendant said was true for purposes of disposing of the petition for revocation.
The court also inquired of the defendant why he did not believe the court "over" his attorney.
"A. I don't know. I was confused. I didn't know what to do. He just told me to sit tight.
"Q. Did something I say confuse you?
"A. No. It's what [my attorney]"
This leads us to the issue whether or not the advice of defendant's attorney constitutes *905 legal justification for the defendant to renege on his condition of probation to make restitution for the cost of the window to the car and to repay the County the funds it expended for his court-appointed attorney.
An attorney at law is an officer of the court and is afforded considerable latitude in carrying out his professional responsibilities to his client. Nevertheless, we cannot and do not espouse a concept which would make judicial determinations and orders subordinate to the advice an attorney gives to his client.
In United States v. Prugh, 479 F.2d 611, 613 (8th Cir. 1973), the defendant argued that he acted only in good faith, relying upon the advice of his counsel, when he performed an act which violated the Securities Act. The Court observed that:
"His attorney did not issue an opinion letter and specifically stated that his informal opinion was based only on the information which Prugh himself had given to the attorney. The trial court found that Prugh did not act in good faith and such finding is fully supported by the record. Prugh's excuses on the cold record are lame and emit a hollow ring."
The following judicial statements have full application to this case.
"It is generally held that the advice of counsel, even though followed in good faith, furnishes no excuse to a person for violating the law and cannot be relied upon as a defense in a criminal action. Forwood v. State, 49 Md. 531, 538; Miller v. United States, 4 Cir., 277 F. 721. Moreover, advice given by a public official, even a State's Attorney, that a contemplated act is not criminal will not excuse an offender if, as a matter of law, the act performed did amount to a violation of the law. State v. Foster, 22 R.I. 163, 46 A. 833, 50 L.R.A. 339; Staley v. State, 89 Neb. 701, 131 N.W. 1028, 34 L.R.A., N.S., 613; State v. Whiteaker, 118 Or. 656, 247 P. 1077. These rules are founded upon the maxim that ignorance of the law will not excuse its violation. If an accused could be exempted from punishment for crime by reason of the advice of counsel, such advice would become paramount to the law." Hopkins v. State, 193 Md. 489, 69 A.2d 456, 460 (Md. 1949).
In State v. Pyle, 71 N.W.2d 342, 346 (N.D. 1955), this Court said:
"... it is a well-established rule that ignorance of the law excuses no one...."
and quoted approvingly from Wess v. South Dakota Packing & Shipping Co., 43 S.D. 467, 180 N.W. 510, 511, as follows:
"It seems to be generally held that the Legislature, in the exercise of the police power may prohibit, under criminal penalty, the performance of a specific act. The doing of the prohibited act constitutes the crime, and the purity of the motive by which the act is prompted, and the knowledge or ignorance of its criminal character, are immaterial on the issue of guilt."
In State of Washington v. Smith, 12 Wash.App. 514, 530 P.2d 354, 358 (1974), the Court said:
"An erroneous admonition by a government official, based on a mistaken interpretation of the law given in good faith to one represented by counsel then present, the latter advising him concerning what he should do in response to the admonition, does not create an estoppel against the state from invoking criminal sanctions otherwise applicable. Rust v. Western Washington State College, 11 Wash.App. 410, 523 P.2d 204 (1974). Rust quotes from and follows State v. Northwest Magnesite Co., 28 Wash.2d 1, 24, 182 P.2d 643 (1947)."
In Giant of Maryland, Inc. v. State's Attorney, 274 Md. 158, 334 A.2d 107, 119 (1975), the Court in considering a contempt order for violating a state law, said:
"Although `the fact that failure to comply with the judicial command was based on the advice of counsel is generally held to be no justification,' Weaver v. State, 244 Md. 640, 644, 224 A.2d 684, 687 (1966); *906 Tyler v. Baltimore County, 256 Md. 64, 67, 259 A.2d 307, 309 (1969), and although advice given by a State's Attorney that a contemplated act would not be criminal has been held not to excuse an offender if, as a matter of law, the act performed would amount to a violation of the law, Hopkins v. State, 193 Md. 489, 498, 69 A.2d 456, 460, appeal dismissed, 339 U.S. 940, 70 S.Ct. 797, 94 L.Ed. 1357 (1950), we think that the consultation by the vice-president and counsel for Giant in 1968, before it commenced holding `Associates Day' at its store in the Free State Mall, while not constituting a defense to a charge for criminal contempt, was evidence of a lack of contumacious intent on its part to violate the provisions of Art. 27, § 534H, when it thereafter periodically conducted `Associates Day' including the one held on Sunday, December 16, 1973."
In Needham v. State, 55 Okl.Cr. 430, 32 P.2d 92, 93 (1934), the Court said:
"It is well established that an accused cannot prove as a defense that he acted upon the advice of counsel in committing the act complained of, because if such were the law it would be placing the advice of counsel above the law itself."
Believing that a law is unconstitutional, even if based on advice of counsel, does not constitute a valid defense for violating the law.
"Certainly, no theory is to be favorably considered which recognizes in public officers the right to determine in their own interest that an act passed for their control is invalid. If those individuals affected by laws are to be conceded the right to disregard and nullify them whenever they believe them to be unconstitutional, or are so advised, anarchy would ensue. The drunken driver, for example, would proceed on his way and meet prosecution with the answer that he had no criminal intent, because he believed and was advised that the act was unconstitutional." Hunter v. State, 158 Tenn. 63, 12 S.W.2d 361, 362 (1928); 61 A.L.R. 1148.
See also, Annotation, 61 A.L.R. 1153 (1929).
In Hunter v. State, supra at 363, the Court also said:
"No case examined justifies a violation of a law on the ground that the accused believed and was advised by counsel that it was unconstitutional. As before suggested, such a holding would be productive of disastrous results, opening a way of escape from prosecution for the criminally inclined through a door held ajar by ignorant, biased, or purchasable advisors."
The fact that the accused acted upon the advice of counsel in committing the act complained of is not a defense. 1 Anderson, Wharton's Criminal Law, § 120 (1957).
As has been shown supra, case law and the authorities agree that a defendant may not successfully rely upon advice of his attorney as a defense for having violated a law.[2] Only where the crime (violation) involved a criminal intent, depending on the circumstances, the legal advice a client received from his attorney may be given some consideration as to intent only, if the client in good faith relied upon it. But in the instant case no such intent is involved.
For the reasons stated herein, the revocation order and judgment of the trial court is in all respects affirmed.
ERICKSTAD, C. J., and PAULSON, PEDERSON and VOGEL, JJ., concur.
NOTES
[1]  The attorney may not have been aware that the court, in conjunction with revoking defendant's parole, issued another deferred imposition of sentence order which incorporated the restitution and reparation conditions of the 26 February 1976 order. This illustrates the necessity for being first fully informed before giving advice to a client.
[2]  No effort has been made in this opinion to construe or interpret the provisions of § 12.1-05-09, NDCC, because it has no application to the issue under consideration.
