**Exhibit 10.40****WESTMORELAND ENERGY LLC** **FIRST AMENDMENT, CONSENT AND RELEASE** **Dated As Of August 22, 2007****to****NOTE PURCHASE AGREEMENT AND RELATED NOTE DOCUMENTS,****Each Dated As Of June 29, 2006****Re: $30,000,000 Floating Rate Senior Notes**
 

 
**FIRST AMENDMENT, CONSENT AND RELEASE**     This First Amendment, Consent and Release dated as of August 22, 2007 (the or this “**FirstAmendment**”) to the Note Agreements each dated as of June 29, 2006 is among Westmoreland Energy LLC,a Delaware limited liability company (the “**Company**”), Westmoreland Power, Inc., a Delawarecorporation (“**WPI**”), Westmoreland Power Operations, LLC, a Virginia limited liability company(“**WPO**”), and Westmoreland Utility Operations, LLC, a Virginia limited liability company (“**WUO**”),Westmoreland — North Carolina Power, L.L.C., a Virginia limited liability company(“**Westmoreland-NC**”) and Westmoreland-Roanoke Valley, L.P., a Delaware limited partnership(“**Westmoreland-RV**”, and together with the Company, WPI, WPO, WUO and Westmoreland-NC, the“**Obligors**”), SOF Investments, L.P., a Delaware limited partnership, as collateral agent (the“**Collateral Agent**”) and each of the purchasers whose names appear at the end hereof (each, a“**Purchaser**” and, collectively, the “**Purchasers**”).**RECITALS:**     A. The Company and each of the Purchasers are parties to a Note Purchase Agreement dated as ofJune 29, 2006 (collectively, the “**Note Purchase Agreement**”). The Company has issued pursuant tothe Note Purchase Agreement $30,000,000 aggregate principal amount of its Floating Rate SeniorNotes (the “**Notes**”, such term to include any such notes issued in substitution therefor pursuant toSection 13 of the Note Purchase Agreement). The Purchasers are the holders of 100]% of theoutstanding principal amount of the Notes.     B. As security for the Note Purchase Agreement, the Company and the other Obligors haveentered into the following agreements: (i) a Pledge and Security Agreement, dated as of June 29,2006 (the “**Company Pledge Agreement**”), by the Company, as pledgor and the Collateral Agent, ascollateral agent for its benefit and the benefit of the other Secured Parties (as defined therein),(ii) a Guaranty, Pledge and Security Agreement, dated as of June 29, 2006 (the “**WPO/WUO PledgeAgreement**”), by WPI, WPO, and WUO, each as pledgor and the Collateral Agent, as collateral agentfor its benefit and the benefit of the other Secured Parties (as defined therein), and (iii) aGuaranty, Distribution Pledge, Collateral Assignment and Security Agreement, dated as of June 29,2006 (the “**WNC/WRV Pledge Agreement**”), by and among Westmoreland-NC and Westmoreland-RV and theCollateral Agent, as collateral agent for its benefit and the benefit of the other Secured Parties(as defined therein).     C. The Company has advised the Collateral Agent and the Purchasers that the Company and theother Obligors desire to (A) sell, transfer and assign to North American Energy Services Company(“**NAES**”) their respective interests in (i) the Facility Operating Agreement, dated as of November22, 2000, between Virginia Electric and Power Company (“**VEPCO**”) and LG&E Power Services LLC, aDelaware limited liability company (“**LPS**” as predecessor in interest to WPO and WUO (by assignmentto, and assumption by, respectively) immediately following the Closing) with respect to VEPCO’spower production facility located in or near Southampton, Virginia; (ii) the Facility OperatingAgreement, dated as of November 22, 2000, between VEPCO and LPS with respect to VEPCO’s powerproduction facility located in or near Altavista, Virginia; (iii) the Facility Operating Agreement,dated as of November 22, 2000, between VEPCO and LPS with respect to VEPCO’s power productionfacility located in or near Hopewell, Virginia, as amended pursuant to Amendment No. 1 dated March4, 2002; (iv) the Operations and Maintenance Agreement, dated as of April 19, 2004, between VEPCOand LPS with respect to VEPCO’s power production facility located in or near Gordonsville,Virginia; and (B) terminate that certain the Amended and Restated Facility Operating Agreement,dated as of December 1, 1993, between the Project Partnership and LPS (as successor in interest inUC Operating Services) and concurrently with the termination thereof. LPS shall enter into a newoperating contract with NAES (the “**New NAES Operating Contract**”), all of the foregoing of whichconstitute “**O&M Agreements**” under the Note
 

 
Purchase Agreement and the other Note Documents (the foregoing collectively being referred toas the “**Transactions**”).     D. The Collateral Agent and the Purchasers have agreed to consent to the Transactions and torelease any and all interests, including, without limitation, any security interests, which theymay have in or to such O&M Agreements, and to amendment the Note Documents or remove any furtherobligations with respect to the O&M Agreements.     E. The Company, the other Obligors, the Collateral Agent and the Purchasers now desire to soamend, modify and release the provisions of the Note Documents as of the date hereof (the“**Effective Date**”) in the respects, but only in the respects, hereinafter set forth.     F. Capitalized terms used herein shall have the respective meanings ascribed thereto in theNote Purchase Agreement unless herein defined or the context shall otherwise require.     G. All requirements of law have been fully complied with and all other acts and thingsnecessary to make this First Amendment a valid, legal and binding instrument according to its termsfor the purposes herein expressed have been done or performed.     **NOW, THEREFORE**, upon the full and complete satisfaction of the conditions precedent to theeffectiveness of the First Amendment set forth in Section 3.1 hereof, and in consideration of goodand valuable consideration the receipt and sufficiency of which is hereby acknowledged, the Companyand the Noteholders do hereby agree as follows:**SECTION 1. AMENDMENTS.**     1.1. Section 7.1(c)(iii) of the Note Purchase Agreement is hereby deleted and accordingly,Section 7.1(c) of the Note Purchase Agreement is hereby amended in its entirety to read as follows:     “(c) *Notice of Default or Event of Default*— promptly, and in any event within five daysafter a Responsible Officer becoming aware of (i) the existence of any Default or Event of Defaultor that any Person has given any notice or taken any action with respect to a claimed defaulthereunder or that any Person has given any notice or taken any action with respect to a claimeddefault of the type referred to in Section 11(f), and (ii) the existence of a “Default” or “Eventof Default” under the Credit Agreement, a written notice specifying the nature and period ofexistence thereof and what action the Company is taking or proposes to take with respect thereto;”     1.2. The definition of “O&M Agreements” in Schedule B to the Note Purchase Agreement is herebydeleted and replaced with the following:““**O&M Agreement**” means that certain Operations and Maintenance Agreement, to be entered intoon or about August 22, 2007, by and between Westmoreland Partners, a Virginia generalpartnership, and North American Energy Services Company, a Washington corporation, withrespect to the Project.”     1.3. Exhibits B-1, B-2 and B-3 to the Note Purchase Agreement shall be and are hereby amendedin its entirety to reflect the modifications to such agreements described herein.
2

 
     1.4. The reference to the “Amended and Restated Facility Operating Agreement, dated as ofDecember 1, 1993, between the Westmoreland-LG&E Partners, a Virginia partnership, and LG&E PowerServices LLC, a Delaware limited liability company (as successor in interest in UC OperatingServices)” in clause (ii) of the proviso of Section 2.2(b) of the WPO/WUO Pledge Agreement and thereference to such agreement elsewhere in the Note Documents, is, in each instance, hereby amendedto read as follows: “the O&M Agreement” References to the Note Purchase Agreement, the WPO/WUOPledge Agreement, and any of the other Note Documents in any of the Note Documents, as herebyamended to refer to such documents as amended hereby.**SECTION 2. CONSENTS AND RELEASES.**     2.1. The Company hereby agrees to apply or cause to be applied the proceeds received from theTransactions, which, as of the date hereof, as expected to be approximately, $804,000, against theoutstanding principal balance of the Notes which would otherwise be due and payable on the MaturityDate, and upon receipt of such funds by the Collateral Agent or the applicable Purchaser, suchfunds shall be so deemed to have been applied.     2.2. In consideration of the agreement the Company as provided in Section 2.1 hereof, theCollateral Agent and the Purchasers hereby (i) consent to the sale, transfer and assignment to NAESof O&M Agreements (for clarity, as defined in Recital C above), and (ii) hereby releases andterminates, which shall be effective as of the Effective Date, all liens and other securityinterests in the O&M Agreements (for clarity, as defined in Recital C above) which have been soldto NAES or otherwise terminated as part of the Transactions, which security interests have been ormay have been granted to the Collateral Agent under or in connection with any of the NoteDocuments; provided, however, that the foregoing consent is limited to the transactions describedin the foregoing subclause (i) and (ii) as provided in the O&M Agreement (as defined in section 1.2above) and the Asset Purchase Agreement dated as of August 22, 2007 by and among NAES, WUO andWestmoreland Technical Services, Inc.     2.3. SOF Investments, L.P. in its capacity as holder (“Holder”) of the Warrant No. R-1 (the“Warrant”) (A) acknowledges receipt of notice in that certain letter (the “July 18 Letter”), datedJuly 18, 2007, of the Company’s intent to conduct a rights offering and related transactions andits consideration of a possible exchange offer (each, an “Offering”), and (B) hereby waives therequirement to provide, under Section 2(j) of the Warrant, at least twenty (20) business daysbefore the Offerings prior written notice of “the proposed transaction, the amount of the FairMarket Value per share and the amount of the fair market value of any Non-Cash Considerationinvolved in the transaction as determined by the Board of Directors of the Company (including thebasis therefor)” (as used and defined in the Warrant). Nothing in this First Amendment or thereceipt by Holder of the July 18 Letter shall be construed as the Holder’s consent to eitherOffering or the terms thereof nor a waiver of any rights under the Warrant or the Note PurchaseAgreement in respect thereof. In connection with each Offering, the Company shall deliver itscalculation of the amount of the Fair Market Value per share and the amount of the fair marketvalue of any Non-Cash Consideration (as these terms are defined in the Warrant) involved in thetransaction, and deliver the certificate required under Section 2(i) of the Warrant within five (5)business days following completion of each Offering, all as otherwise in accordance with the termsand provisions of the Warrant.**SECTION 3. MISCELLANEOUS.**     3.1. This First Amendment shall become effective and binding upon the Company, the otherObligors, the Collateral Agent and the Purchasers on the Effective Date upon each of the followingconditions having occurred: (a) each of the parties hereto shall have executed and delivered tothe other
3

 
parties their respective signature to this First Amendment; and (b) after giving effect to theconsents and releases set forth in Section 2 of this First Amendment, no Default or Event ofDefault shall have occurred and be continuing.     3.2. This First Amendment shall be construed in connection with and as part of the NotePurchase Agreement and the other Note Documents, and except as modified and expressly amended bythis First Amendment, all terms, conditions and covenants contained in the Note Purchase Agreementand the other Note Documents are hereby ratified and shall be and remain in full force and effect.     3.3. Any and all notices, requests, certificates and other instruments executed and deliveredafter the execution and delivery of this First Amendment may refer to the Note Purchase Agreementor nay of the other Note Documents without making specific reference to this First Amendment butnevertheless all such references shall include this First Amendment unless the context otherwiserequires.     3.4. The descriptive headings of the various Sections or parts of this First Amendment are forconvenience only and shall not affect the meaning or construction of any of the provisions hereof.     3.5. Any provision of this First Amendment that is prohibited or unenforceable in anyjurisdiction shall, as to such jurisdiction, be ineffective to the extent of such prohibition orunenforceability without invalidating the remaining provisions hereof, and any such prohibition orunenforceability in any jurisdiction shall (to the full extent permitted by law) not invalidate orrender unenforceable such provision in any other jurisdiction     3.6. This First Amendment may be executed in any number of counterparts, each of which shallbe an original but all of which together shall constitute one instrument. Each counterpart mayconsist of a number of copies hereof, each signed by less than all, but together signed by all, ofthe parties hereto.     3.7. This First Amendment shall be construed and enforced in accordance with, and the rightsof the parties shall be governed by, the law of the State of New York excluding choice of lawprinciples of the law of such State that would permit the application of the laws of a jurisdictionother than such State.
4

 
     3.8. The execution hereof by you shall constitute a contract between us for the uses and purposeshereinabove set forth, and this First Amendment may be executed in any number of counterparts, eachexecuted counterpart constituting an original, but all together only one agreement.      WESTMORELAND ENERGY LLC