
53 P.3d 338 (2002)
137 Idaho 755
Chris HYTA, Plaintiff-Appellant,
v.
Lloyd FINLEY, individually, d/b/a Kopper Keg, Defendant-Respondent.
No. 25906.
Supreme Court of Idaho, Boise, March 2002 Term.
August 13, 2002.
*339 Flammia & Solomon, Coeur d'Alene, for appellant.
Fred W. Gabourie Jr., Post Falls, for respondent.
SCHROEDER, Justice.

ON THE BRIEFS
This is an action on the dissolution of a partnership. Chris Hyta (Hyta) seeks damages in the dissolution, winding up, accounting and termination of an alleged partnership with Lloyd Finley (Finley).

I.

FACTUAL BACKGROUND
Hyta received an inheritance in 1984 which he wanted to invest. Finley, who was an acquaintance, was the sole owner of the Kopper Keg in Kellogg. Hyta and Finley signed an agreement whereby Finley agreed to sell Hyta a "one-half interest" in the Kopper Keg for $50,000. An attorney drafted the agreement, although both Hyta and Finley say that the attorney did not represent either one of them. Hyta paid Finley $18,000 that day, and the remaining $32,000 on December 19 of that year. Finley made regular payments to Hyta from 1984 through 1991.
According to Finley, the Kopper Keg was a bar, but its primary profits came from the illegal gaming machines it was running. Other establishments in the county were allegedly running the same unauthorized gambling devices and poker machines until June, 1991, when the FBI raided 58 of these taverns. This, according to Finley, "marked a sudden end" to profits from the Kopper Keg. Finley states that since there were no more profits, the object of their "Partnership" ended. Therefore, in June, 1991, Finley informed Hyta that he would no longer be paying any share of the proceeds from the gambling devices, because they had been seized by the FBI in the raid. Hyta made demands for Finley to resume payments, but Finley refused. This case followed.

II.

PROCEDURAL BACKGROUND
Hyta filed a complaint in district court on October 12, 1993, alleging that he owned an undivided one-half interest in the Kopper Keg. He asked the court to dissolve the partnership and order payment of profits and assets, costs and attorney fees. Finley counterclaimed, alleging that the money was a personal loan. The district court denied Hyta's motion for partial summary judgment and Finley's motion for summary judgment. In late 1995 both parties filed for partial summary judgment. The district court denied Hyta's motion and granted Finley's motion which requested that Finley's real property not be considered a partnership asset. The court bifurcated the trial: the jury would determine the nature of the business/legal relationship between the parties. If the jury found that there was a partnership, the court would hold an accounting phase.
Several procedural difficulties delayed the trial. The most notable is a hearing in June of 1996 on a motion for sanctions against Finley's attorney, who did not attend, although he was served with notice. Hyta's attorney alleged that she was not receiving the information she needed to prepare adequately for the trial; that she had not yet received a list of witnesses; that Finley had not provided any receipts or invoices from the operations (both legitimate and illegal) from the Kopper Keg. The court set an order with a 30 day deadline. Finley missed the deadline by more than a month, and at a hearing on July 30, 1996, requested clarification of the specific documents requested. He had provided Hyta with some pre-trial documents the day before but still had not provided the others contained in the order. The court granted Finley an extension to produce all requested documents by September 1, 1996.
*340 A jury trial was finally held in February, 1997. The jury found that 1) there was a legally binding contract; 2) Hyta did not make all the required payments on time; and 3) Hyta and Finley did not enter into a partnership known as the Kopper Keg, wherein Finley would be managing partner. The court entered a JNOV on February 20, 1998, finding that Hyta did make the requisite payments and that a partnership did exist. A special master was appointed for the accounting, and the court ordered Finley to disclose all financial records and transactions that the special master required, or it would consider sanctions. Finley's attorney was not present at that hearing.
On May 13, 1999, a bench trial was held to account for the assets and profits of the partnership. The special master presented his findings. The special master concluded that the Kopper Keg operated at a profit from 1992-1998, totaling $205,094.53. Finley testified that the Kopper Keg had not turned a profit since 1991. The only written records he had were his personal income tax returns. The district court issued an opinion holding that 1) the partnership ceased to exist after 1991, and 2) that insufficient evidence prevented an equitable accounting to wind up the partnership. Hyta appealed.

III.

THE DISTRICT COURT ERRED IN DETERMINING THE PARTNERSHIP TERMINATED IN 1991
Dissolution does not result in the termination of a partnership. Uniform Partnership Law, Title 53, Chapter 3. This Court analyzed the process of terminating a partnership relationship in Mays v. Davis, 132 Idaho 73, 75, 967 P.2d 275, 277 (1998), noting the following:
The dissolution of a partnership "is the change in the relation of the parties caused by any partner ceasing to be associated in the carrying on as distinguished from the winding up of the business." Kelly v. Silverwood Estates, 127 Idaho 624, 628, 903 P.2d 1321, 1325 (1995) (citing I.C. § 53-329). A partnership is not terminated upon dissolution, but continues until the winding up of the partnership affairs is completed. Arnold v. Burgess, 113 Idaho 786, 790, 747 P.2d 1315, 1319 (Ct.App.1987) (citing I.C. § 53-330; Heileson v. Cook, 108 Idaho 236, 697 P.2d 1250 (Ct.App. 1985)). Winding up is the process of settling partnership affairs after dissolution, and generally involves an accounting and liquidation of the partnership's assets.
The change in relationship that resulted in dissolution happened when Finley stopped making payments to Hyta in 1991. However, a partnership does not end upon dissolution but "continues until the winding up of the partnership affairs is completed." Id. at 75, 967 P.2d at 277.
Winding up includes an accounting and liquidation of the partnership's assets. Ramseyer v. Ramseyer, 98 Idaho 47, 51, 558 P.2d 76, 80 (1976), states that "a partnership relationship is legally ended and its affairs completed when the three steps of 1) dissolution, 2) winding up or liquidation, and 3) termination are finished." The district court did not have the authority to make the determination that the partnership was terminated until an accounting and asset liquidation had been done. An accounting and liquidation still have not been done. The district court erred in finding that the partnership terminated in 1991.

IV.

THE LEGALITY OF THE CONTRACT
A question not raised by the parties or addressed by the district court is whether the partnership between Hyta and Finley was an illegal contract. Neither party suggests that the contract might be void as against public policy if the parties entered into it with the intention of sharing profits from the illegal gaming activities. In Quiring v. Quiring, 130 Idaho 560, 944 P.2d 695 (1997), this Court said that:
Whether a contract is against public policy is a question of law for the court to determine from all the facts and circumstances of each case. Stearns v. Williams, 72 Idaho 276, 283, 240 P.2d 833, 840 (1952). Public policy may be found and set forth in the statutes, judicial decisions or the constitution. Id. at 287, 240 P.2d at 842. An *341 illegal contract is one that rests on illegal consideration consisting of any act or forbearance which is contrary to law or public policy. 17A AM.JUR.2D CONTRACTS § 239; see Miller v. Haller, 129 Idaho 345, 924 P.2d 607 (1996). A contract prohibited by law is illegal and hence unenforceable. Miller, 129 Idaho at 351, 924 P.2d at 613.
Although not clearly argued below or addressed in either the magistrate's decision or the district court, in Idaho a court may not only raise the issue of whether a contract is illegal sua sponte, Nab v. Hills, 92 Idaho 877, 882, 452 P.2d 981, 986 (1969); Belt v. Belt, 106 Idaho 426, 430 n. 2, 679 P.2d 1144, 1148 n. 2 (Ct.App.1984), but it has a duty to raise the issue of illegality, whether pled or otherwise, at any stage in the litigation. Stearns, 72 Idaho at 290, 240 P.2d at 842.
Id. at 566-67, 944 P.2d 701-02.
The courts will not enforce the agreement if it is illegal or contrary to public policy. In this case the contract may have been entered into for some legal and some illegal purposes. The evidence of the potential illegal intentions of the parties in this case comes from the district judge, who deemed the FBI raid to have terminated the purposes of the partnership, and from Finley who argues that when the gaming came to an end, so did the profits and purposes of the partnership. This is an issue that should be addressed by the district court upon remand.

V.

CONCLUSION
The judgment of the district court is vacated and the case is remanded for further proceedings. Costs are awarded to Hyta.
Chief Justice TROUT, Justices WALTERS, KIDWELL and EISMANN concur.
