OPINION OF THE COURT
Rosenblatt, J.For well over a century, parties to construction contracts in New York were permitted by decisional law and by statute to *627agree to “pay-if-paid” provisions. Agreements of that type create a condition precedent by which the subcontractor will not be paid unless the contractor has been paid. In 1995, however, we held in West-Fair Elec. Contrs. v Aetna Cas. & Sur. Co. (87 NY2d 148 [1995]) that such contracts violate New York’s public policy as expressed in Lien Law § 34. That section provides in pertinent part: “Notwithstanding the provisions of any other law, any contract, agreement or understanding whereby the right to file or enforce any lien created under article two is waived, shall be void as against public policy and wholly unenforceable. ’ ’
In the case before us, plaintiff subcontractor is a Delaware corporation and defendant general contractor is a Florida corporation. The parties agreed that Florida law would govern their contract. Unlike New York, Florida allows pay-if-paid contracts. We must determine whether New York’s public policy against such contracts is so fundamental that it should override the parties’ choice of law. We hold that it is not, and that the parties’ choice of law controls. As we said in Cooney v Osgood Mach. (81 NY2d 66, 79 [1993]), “plainly not every difference between foreign and New York law threatens our public policy. Indeed, if New York statutes or court opinions were routinely read to express fundamental policy, choice of law principles would be meaningless.”1
I
On September 10, 1999, Telergy Metro LLC engaged defendant MasTec North America, Inc. to construct a fiber optic telecommunications network from Pleasant Valley to New York City. On November 28, 2000, MasTec subcontracted with plaintiff Welsbach Electric Corp. to do the electrical work for the project. The subcontract included a pay-if-paid clause stating that:
“Upon final acceptance of the Work by Contractor and Owner, Contractor will pay Subcontractor for the Work at the prices and schedule and in the manner described in Schedule 1; provided that, all payments to Subcontractor by Contractor are expressly contingent upon and subject to receipt of payment for *628the Work by Contractor from Owner . . . (Emphasis added.)
The parties also agreed that termination, suspension or delay of the primary contract between Telergy and MasTec automatically terminated, suspended or delayed the subcontract on both the same basis and effective date. In the event of termination, suspension or delay, Welsbach would be allowed to recover from the owner amounts payable to MasTec less any anticipated gross profit from the work.
In August 2001, Telergy became insolvent and terminated its contract with MasTec, effectively terminating the subcontract. MasTec, and in turn, Welsbach, were not fully paid for their work. Welsbach sued MasTec for the unpaid balance under the subcontract.
In its fifth and eleventh affirmative defenses MasTec asserted that: (1) Florida law, which enforces pay-if-paid provisions, governs the subcontract; MasTec never received payment from Telergy and therefore owes no money to Welsbach and (2) Welsbach can seek recovery only from Telergy, pursuant to the termination provision in the subcontract.
Welsbach moved for partial summary judgment and dismissal of those affirmative defenses, arguing that the subcontract’s pay-if-paid provision violates Lien Law § 34. MasTec cross-moved for leave to serve an amended answer with two counterclaims. Supreme Court struck the two affirmative defenses, otherwise denied Welsbach’s motion, and granted MasTec’s cross motion. The court held that although pay-if-paid clauses are enforceable in Florida, they violate Lien Law § 34 because the subcontractor is forced to assume the risk that the owner will fail to pay the general contractor. On an appeal to the Appellate Division from so much of Supreme Court’s order as struck the affirmative defenses, that Court, with one Justice dissenting, affirmed. We now reverse.
II
Both sides agree that the subcontract’s pay-if-paid clause violates New York’s public policy.2 Were we not dealing with choice of law, we would simply apply Lien Law § 34 as inter*629preted in West-Fair and the case would be closed. The issue before us, however, is whether our public policy is so unyielding that it trumps the parties’ agreement to apply the law of another state. Put differently, there are two conflicting policies at work here: one, that parties should be free to chart their own contractual course, the other, that there are certain contracts the State will not allow.
Generally, courts will enforce a choice-of-law clause so long as the chosen law bears a reasonable relationship to the parties or the transaction (Cooney, 81 NY2d at 70-71). A basic precept of contract interpretation is that agreements should be construed to effectuate the parties’ intent (see Greenfield v Philles Records, 98 NY2d 562, 569 [2002]; see R/S Assoc. v New York Job Dev. Auth., 98 NY2d 29, 32 [2002]; W.W.W. Assoc. v Giancontieri, 77 NY2d 157, 162 [1990]). Where an agreement is clear and unambiguous, a court is not free to alter it and impose its personal notions of fairness (see Vermont Teddy Bear Co. v 538 Madison Realty Co., 1 NY3d 470, 475 [2004]; Greenfield, 98 NY2d at 570; Reiss v Financial Performance Corp., 97 NY2d 195, 199 [2001]).
The freedom to contract, however, has limits. Courts will not, for example, enforce agreements that are illegal3 or where the chosen law violates “some fundamental principle of justice, some prevalent conception of good morals, some deep-rooted tradition of the common weal” (Cooney, 81 NY2d at 78, quoting Loucks v Standard Oil Co. of N.Y., 224 NY 99, 111 [1918]; see generally Restatement [Second] of Conflict of Laws § 187 [2]). “If . . . the foreign law does not entail any such violation . . . full effect should be given to the law of our sister State” (Ehrlich-Bober & Co. v University of Houston, 49 NY2d 574, 584 [1980]). Crucially, however, we have reserved the public policy exception “for those foreign laws that are truly obnoxious” (Cooney, 81 NY2d at 79).
*630This appeal requires us to examine the policy considerations underlying Lien Law § 34 to determine whether it embodies a concept so fundamental to our law as to meet this test. We have characterized concepts as “fundamental” in other contexts. For example, in Scheiber v St. John’s Univ. (84 NY2d 120, 125 [1994]), we recognized that the “Human Rights Law . . . effects this State’s fundamental public policy against discrimination by establishing equality of opportunity as a civil right.” We said in Sanders v Winship (57 NY2d 391, 395 [1982]) that legislation outlawing discrimination in the sale of cooperative real estate interests is a “fundamental State policy.” Also, in Matter of Board of Higher Educ. of City of N.Y. v Carter (14 NY2d 138, 144 [1964]), we noted that interdiction of discrimination in civil rights based on race or creed is a “fundamental public policy of New York.” For reasons that follow, we agree with MasTec and the dissenting Justice that Lien Law § 34, which deals with risk allocation under a construction contract, is not of this tenor.
Ill
Mechanics’ liens did not exist at common law; they are creatures of statute (Birmingham Iron Foundry v Glen Cove Starch Mfg. Co., 78 NY 30, 32 [1879]; Derby, The New Mechanics’ Lien Law of the State of New York, Preface [1885]). The first mechanics’ lien law of New York was enacted in 1830 (L 1830, ch 330). Early New York treatises on mechanics’ liens recognized that the right to file a lien could be waived.4 In fact, New York courts, as well as those of our sister states, consistently enforced clear and unambiguous hen waivers.5 Indeed, in 1922 we held that “[n]o good reason can be suggested . . . why a contractor cannot, for a valuable consideration, waive the provisions of the statute giving him the right to file a notice of *631lien” (Cummings v Broadway-94th St. Realty Co., Inc., 233 NY 407, 411-412 [1922]; see also Embury v Conner, 3 NY 511, 519 [1850]; Buel v Trustees of Vil. of Lockport, 3 NY 197, 200 [1849]).
In 1929 the Legislature enacted Lien Law § 34. The statute codified decisional law allowing contractors, subcontractors, material suppliers and laborers to waive their right to file and enforce a lien by a signed, written agreement expressing such intent. For decades thereafter, courts upheld these waivers pursuant to Lien Law § 34.6
It was not until 1975 that the Legislature repealed the 1929 statute and replaced it with the current version of Lien Law § 34. Even then, the courts perceived no connection between section 34’s waiver prohibition and pay-if-paid contracts. Courts continued to uphold pay-if-paid clauses where the parties clearly agreed that payment to the contractor was a condition precedent to the contractor’s obligation to pay the subcontractor. (See Schuler-Haas Elec. Corp. v Aetna Cas. & Sur. Co., 49 AD2d 60 [4th Dept 1975], affd 40 NY2d 883 [1976] [“(I)f the parties clearly expressed an intention that no subcontractor . . . should have a right to be paid or to sue on the payment bond until all questions relating to the contracts have been resolved and the owner has made his final payment due under the contract to the general contractor, such agreement would be binding, and it would constitute a condition precedent to plaintiff’s action against the surety” (emphasis added)].)7
By the 1990’s there were growing doubts as to whether Lien Law § 34 could abide pay-if-paid contracts, as courts began to realize that such agreements arguably operated as forbidden waivers of the right to enforce a mechanics’ lien. As recently as 1995, the Second Circuit Court of Appeals certified to us the question whether Lien Law § 34 is violated when the parties agree that the subcontractor will not be paid if the contractor *632goes unpaid (see West-Fair Elec. Contrs. v Aetna Cas. & Sur. Co., 49 F3d 48 [2d Cir 1995]). The Second Circuit suggested that a condition precedent of that type “appears to run counter to New York public policy” (id. at 50), but was uncertain and asked us for a definitive ruling. In 1995 we rendered one, holding in West-Fair that pay-if-paid clauses are “void and unenforceable as contrary to public policy set forth in Lien Law § 34” (87 NY2d at 158).8
Section 34 seeks to protect New York subcontractors from the oppressive use of bargaining power. Here, neither party is a New York corporation; notably, MasTec is a Florida corporation. As dissenting Justice Krausman pointed out, both are sophisticated commercial entities that knowingly and voluntarily entered into the subcontract. Considering these factors and given the checkered history of pay-if-paid clauses in the construction industry, we cannot say they are “truly obnoxious” so as to void the parties’ choice of law. In short, Welsbach has not sustained its “heavy burden” of proving that application of Florida law would be offensive to a fundamental public policy of this State (see Cooney, 81 NY2d at 80).
Accordingly, the order of the Appellate Division should be reversed, with costs, plaintiffs motion, insofar as it seeks to dismiss the fifth and eleventh affirmative defenses interposed in the answer, denied and the certified question answered in the negative.
Chief Judge Kaye and Judges Ciparick, Graffeo, Read, Smith and Pigott concur.
Order reversed, etc.
. For an expansive analysis of Cooney, see Aaron D. Twerski’s article, A Sheep in Wolf’s Clothing: Territorialism in the Guise of Interest Analysis in Cooney v. Osgood Machinery, Inc. (59 Brook L Rev 1351 [Winter 1994]).
. Courts and lawyers refer also to “pay-w/iere-paid” clauses and sometimes use the phrases interchangeably. They are different. In Schuler-Haas Elec. Co. v Aetna Cas. & Sur. Co., the contract provided that payment was due from the contractor to the subcontractor when the owner paid the contractor. We found this not to be a condition precedent but a timing mechanism (40 NY2d 883, *629885 [1976]). We need not discuss the different ramifications of the “when” versus “if” formulations, which have been the subject of extensive commentary (see Carney and Cizek, Payment Provisions in Construction Contracts and Construction Trust Fund Statutes: A Fifty-State Survey, 24 Constr Law 5 [Fall 2004]; Margie Alsbrook, Contracting Away an Honest Day’s Pay: An Examination of Conditional Payment Clauses in Construction Contracts, 58 Ark L Rev 353 [2005]). For purposes of this appeal, no one doubts that the contract contains a “pay-if-paid” clause in the form of a condition precedent.
. Balbuena v IDR Realty LLC, 6 NY3d 338 (2006); Szerdahelyi v Harris, 67 NY2d 42 (1986); see generally 5 Williston, Contracts § 12:1, at 546-603 (4th ed).
. See Blanc, New York Law of Mechanics’ Liens 1Í 10a, at 38-39 (1949); Griffin, A Treatise on the Law of Mechanics’ Liens of the State of New York § 13, at 70-73 (1929); Jensen, A Treatise on the Mechanics’ Lien Law of the State of New York § 217, at 263-265 (3d ed 1929); Ray, A Treatise on the Law of Mechanics’ Liens and General Contracting of the State of New York § 202, at 374-375 (1914); Kneeland, A Treatise upon the Principles Governing the Acquisition and Enforcement of Mechanic’s Liens § 134, at 149 (1876).
. See Cummings v Broadway-94th St. Realty Co., Inc., 233 NY 407, 411-412 (1922); Phyfe v Eimer, 45 NY 102 (1871); Hedden Constr. Co. v Proctor & Gamble Co., 62 Misc 129 (Sup Ct, Richmond County 1908); Matthews v Young, 16 Misc 525 (Sup Ct, Special Term, Erie County 1896); Davis v La Crosse Hosp. Assn., 121 Wis 579, 583, 99 NW 351, 352 (1904); Scheid v Rapp, 121 Pa 593, 15 A 652 (1888); Long v Caffrey, 93 Pa 526 (1880); Bowen v Aubrey, 22 Cal 566 (1863).
. See McCreary Co. v People, 267 NY 37 (1935); Mascioni u Miller, Inc., 261 NY 1 (1933); Atlantic Co. v Jarll Realty Corp., 36 AD2d 883, 884 (3d Dept 1971); J. P. Cieri Constr. Co. v Gramercy Constr. Corp., 13 AD2d 901, 902 (4th Dept 1961); Arrow Bldrs. Supply Corp. v Hartsdale Town House, 11 Misc 2d 746 (Sup Ct, Westchester County 1958), affd 7 AD2d 755 (1958); Arr-Em Plastering Corp. v 515 E. 85th St. Corp., 25 AD2d 59, 61 (1st Dept 1966); MacArthur Concrete Pile Corp. v Kew Queens Corp., 276 App Div 1015, 1016 (2d Dept 1950).
. See also David Fanarof, Inc. v Dember Constr. Corp., 195 AD2d 346 (1st Dept 1993); Crown Plastering Corp. v Elite Assoc., 166 AD2d 495 (2d Dept 1990); Jespersen-Kay Modular Constr. Ltd. v Clinton Ave. Paul Place Houses, 85 Misc 2d 721 (Sup Ct, Monroe County 1976).
. A recent article surveyed the treatment of pay-if-paid clauses across the nation (Carney and Cizek, Payment Provisions In Construction Contracts and Construction Trust Fund Statutes: A Fifty-State Survey, 24 Constr Law 5 [Fall 2004]). While some states have legislatively declared conditional payment provisions unenforceable or have restricted their application, California is the only other state that has voided pay-if-paid provisions as against public policy (see Wm. R. Clarke Corp. v Safeco Ins. Co., 15 Cal 4th 882, 938 P2d 372 [1997]). Moreover, it was not until 2002 that New York enacted section 757 of the General Business Law rendering void any provision that makes a construction contract subject to the laws of another state.