
302 N.W.2d 405 (1981)
John SCHNEIDER and Theresa Schneider, Plaintiffs and Appellants,
v.
Terry STRIEFEL, Defendant and Appellee.
Civ. No. 9856.
Supreme Court of North Dakota.
February 24, 1981.
*406 Teevens, Johnson, Montgomery, Minot, for plaintiffs and appellants; submitted by Bruce R. Montgomery, Minot, on brief.
McClintock, Butz & Kraft, Rugby, for defendant and appellee; submitted by Carlan J. Kraft, Rugby, on brief.
SAND, Justice.
The plaintiffs, John and Theresa Schneider [the Schneiders], appeal from a district court judgment awarding them $811.02.
On 16 March 1972 the Schneiders, and the defendant, Terry Striefel [Striefel], entered into a five-year written lease agreement whereby Striefel rented 180 acres of land owned by the Schneiders in Pierce County, North Dakota. The lease provided for annual rent payments of $900 by Striefel and also gave him an option to renew the lease for an additional five-year term.
The parties subsequently became involved in a lawsuit concerning their option rights and responsibilities under the five-year lease. However, that lawsuit is only indirectly involved in this appeal. That lawsuit [Terry Striefel v. John Schneider, Pierce County Civil No. 5601] was tried in November 1977 and a memorandum opinion was issued on 24 April 1978 which established that Striefel had validly exercised his option to renew the lease in 1977 and was entitled to possession of the leased premises from 1977 through 1981 under the renewed lease.
*407 Striefel had tendered a $900 check for the rent payment in 1977, but the Schneiders returned the check because of the pending litigation. During the 1977 crop year the Schneiders used a portion of the 180 acres for grazing cattle and also harvested at least ten tons of hay from part of the land. Although Striefel did not farm the 180 acres in 1977, he applied to the Agriculture Stabilization and Conservation Service office for disaster payments because 1977 was a drought year. Striefel received $1,598.76 disaster payments calculated on the basis of the entire 440-acre farm owned by the Schneiders.
In the spring of 1978 and before the district court's memorandum opinion establishing Striefel's right to possession was issued, the Schneiders began working and seeding portions of the 180 acres for the 1978 crop year. The Schneiders' attorney had advised them that if they went on the leased premises and later received an adverse ruling on their right to possession, they would be entitled to reimbursements for their expenses to prepare the land for the 1978 crop year.
After Striefel's right to possession of the 180 acres was established, the Schneiders commenced the present action for the 1977 rent; their proportionate share of the ASCS disaster payments; and restitution for work and goods supplied in conjunction with the 1978 crop. Striefel counterclaimed for damages resulting from the Schneiders' use of the leased premises during the 1977 crop year.
The district court entered a judgment awarding the Schneiders $900 for the 1977 rent and $651.02 as their share of the ASCS disaster payment for a total of $1,551.02. This amount was set off by $100 for the hay harvested by the Schneiders in 1977 and $640 for grazing cattle on the leased premises in 1977. The district court rejected the Schneiders' claim for restitution for work and goods supplied in conjunction with the 1978 crop year. The amount of the Schneiders' judgment, after set off, was $811.02, and they appeal from that judgment.
The first issue Schneider raises on this appeal concerns the amount of setoff allowed to Striefel because of the Schneiders' use of part of the leased premises to graze cattle in 1977. The district court made the following pertinent finding of fact:

"VIII.
"That the Plaintiff grazed his cattle upon 80 acres of the land in question in 1977, the value of which grazing was $640.00."
The Schneiders made a motion to amend the judgment and reduce the setoff because, as they asserted, the evidence and testimony presented at trial established that in 1977 the Schneiders grazed cattle on 60, and not 80 acres of the land. The district court denied the Schneiders' motion.
John Schneider testified as follows concerning the number of acres grazed:
"THE COURT: Mr. Schneider, let me ask you, how many acres of the 180 acres in question did you graze as pasture in 1977? Can you answer that for me?
"THE WITNESS: The 60 acres here, these two parcels. This would be the south often acres of Lot 2 and 1 and the southeast quarter of the northeast quarter and the southwest quarter of the southeast quarter in Balta Township.
"THE COURT: A total of 100 acres were
"THE WITNESS: One hundred acres, yes.
"THE COURT: grazed by you in 1977?
"THE WITNESS: Yes."
Our review of this testimony and other references in the transcript to the amount of acres grazed by the Schneiders in 1977 reflects that the trial court's finding is not clearly erroneous. Rule 52(a), North Dakota Rules of Civil Procedure.
The last issue the Schneiders raise on this appeal concerns the trial court's refusal to award damages based on the Schneiders' claim for restitution because of unjust enrichment. The Schneiders, in *408 part, base their claim for unjust enrichment upon the advice given to them by their attorney.
In State v. Thorstad, 261 N.W.2d 899 (N.D.1978), we dealt with an analogous proposition in a criminal case. In Thorstad, supra, we determined that the advice of an attorney was not legal justification for the defendant to renege on his conditions of probation which were to make restitution for the cost of a window and to repay the County for funds expended by his court-appointed attorney. Although Thorstad was a criminal case, we perceive no reason not to extend that doctrine to this civil case. Accordingly, we conclude that the advice given by Schneiders' attorney does not constitute a justification which would entitle them to restitution.
Furthermore, in A & A Metal Buildings v. I-S, Inc., 274 N.W.2d 183, 188 (N.D.1978), we observed that "unjust enrichment is an equitable theory that may be used when a person retains a benefit which in justice and equity belongs to another."
In A & A Metal Buildings, supra, at 189, we also delineated the five elements for recovery under the theory of unjust enrichment:
"1. An enrichment;
"2. An impoverishment;
"3. A connection between the enrichment and impoverishment;
"4. Absence of a justification for the enrichment and impoverishment; and
"5. An absence of a remedy provided by law."
The district court made the following pertinent findings of fact:

"IX.
"That Plaintiff broke, cultivated, fertilized and seeded portions of the land in question in the spring of 1978.
"X.
"That the Defendant derived no ascertainable benefit from Plaintiff's work performed on the lands in Section 6.
"XI.
"That the Defendant derived some limited benefit from Plaintiff's work performed on the land in Section 31.
"XII.
"That at the time Plaintiff went upon the land in question and performed spring's work thereon, the issue of the right to the possession and enjoyment of the land in question was pending before the Pierce County District Court in civil case number 5601, Terry Striefel v. John Schneider."

Our review of the record reflects that the trial court's findings that Striefel received little or no benefit from the work done by the Schneiders are supported by substantial evidence and, therefore, are not clearly erroneous. Rule 52(a), NDRCivP.
Furthermore, because the Schneiders went on the land while their right to possession was pending even though it was upon advice of their attorney, we cannot conclude that, in equity and good conscience, they are entitled to recover on the theory of unjust enrichment.
For reasons stated in this opinion, the district court judgment is affirmed.
ERICKSTAD, C. J., and PAULSON, PEDERSON and VANDE WALLE, JJ., concur.
