EXHIBIT 10.6 FIRST AMENDMENT TO AMENDED AND RESTATED CREDIT AGREEMENT [Letter of Credit and Hedged Inventory Facility] THIS FIRST AMENDMENT TO AMENDED AND RESTATED CREDIT AGREEMENT [Letter of Credit and Hedged Inventory Facility] (this "Amendment") dated as of the 25th day of May, 2001, by and among PLAINS MARKETING, L.P. ("Borrower"), ALL AMERICAN PIPELINE, L.P. and PLAINS ALL AMERICAN PIPELINE, L.P., as guarantors, FLEET NATIONAL BANK, as Administrative Agent, and the Lenders party hereto. W I T N E S S E T H: WHEREAS, Borrower, All American, Plains MLP, Administrative Agent and Lenders entered into that certain Amended and Restated Credit Agreement [Letter of Credit and Hedged Inventory Facility] dated as of May 4, 2001 (the "Original Agreement") for the purposes and consideration therein expressed, pursuant to which Lenders became obligated to make and made loans to Borrower as therein provided; and WHEREAS, Borrower, All American, Plains MLP, Administrative Agent and Lenders desire to amend the Original Agreement for the purposes described herein; NOW, THEREFORE, in consideration of the premises and the mutual covenants and agreements contained herein and in the Original Agreement, in consideration of the loans which may hereafter be made by Lenders to Borrower, and for other good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, the parties hereto do hereby agree as follows: ARTICLE I. -- Definitions and References (S) 1.1. Terms Defined in the Original Agreement. Unless the context otherwise requires or unless otherwise expressly defined herein, the terms defined in the Original Agreement shall have the same meanings whenever used in this Amendment. (S) 1.2. Other Defined Terms. Unless the context otherwise requires, the following terms when used in this Amendment shall have the meanings assigned to them in this (S) 1.2. "Amendment" means this First Amendment to Amended and Restated Credit Agreement [Letter of Credit and Hedged Inventory Facility]. "Amendment Documents" means this Amendment. "Credit Agreement" means the Original Agreement as amended hereby. 1 ARTICLE II. -- Amendments (S) 2.1. Definitions. (a) The definitions of "Change of Control", "Consolidated Net Worth", "General Partner" and "Wholly-Owned Subsidiary" set forth in Section 1.1 of the Agreement are hereby amended in their entirety to read as follows: "Change of Control" means the occurrence of any of the following events: (i) Qualifying Directors cease for any reason to constitute collectively a majority of the members of the board of directors of GP LLC (the "Board") then in office; (ii) GP LLC shall cease to be, directly or indirectly, the sole legal and beneficial owner (within the meaning of Rule 13d-3 under the Securities Exchange Act of 1934, as amended) of all of the general partner interests (including all securities which are convertible into general partner interests) of the General Partner; (iii) General Partner shall cease to be, directly or indirectly, the sole legal and beneficial owner (as defined above) of all of the general partner interests (including all securities which are convertible into general partner interests) of Plains MLP; (iv) Plains MLP shall cease to be, directly or indirectly, the sole legal and beneficial owner (as defined above) of all (a) equity interests of Plains Newco LLC, (b) limited partner interests of Borrower and All American, (c) partner interests of Plains Marketing Canada, L.P. (other than the limited partner interests of Plains Marketing Canada, L.P. that may be issued to CanPet Energy Group (USA), Inc. or CanPet Energy Group Inc. as permitted under Section 7.4), or (d) capital stock of PMC (Nova Scotia) Company; or (v) Neither General Partner nor Plains MLP shall continue to be, directly or indirectly, the sole legal and beneficial owner of the general partner interest in Borrower and All American. As used herein, "Qualifying Director" means (i) any Person designated by any Qualifying Owner as its representative on the Board, (ii) so long as Qualifying Owners own a majority of the ownership interests of GP LLC entitling the holders thereof to vote in elections for directors of GP LLC, any Person elected by a majority of such owners of GP LLC entitled to vote thereon, and (iii) the chief executive officer of GP LLC, and "Qualifying Owner" means Plains Resources Inc., Kayne Anderson Investment Management, EnCap Investments LLC, Sable Minerals, or any Affiliate of any of the foregoing. "Consolidated Net Worth" means the remainder of all Consolidated assets, as determined in accordance with GAAP, of Plains MLP and its Subsidiaries minus the sum of Plains MLP's Consolidated liabilities, as determined in accordance with GAAP. The effect of any increase or decrease in net worth in any period as a result of items of income or loss not reflected in the determination 2 of net income but reflected in the determination of comprehensive income (to the extent provided under GAAP as in effect on the date hereof) shall be excluded in determining Consolidated Net Worth. "General Partner" means Plains AAP, L.P., a Delaware limited partnership, in its capacity as the sole general partner of Plains MLP. "Wholly Owned Subsidiary" means any Subsidiary of a Person, all of the issued and outstanding stock, limited liability company membership interests, or partnership interests of which (including all rights or options to acquire such stock or interests) are directly or indirectly (through one or more Subsidiaries) owned by such Person. (b) Clause (A) of the definition of "Permitted Acquisitions" set forth in Section 1.1 of the Original Agreement is hereby amended in its entirety to read as follows: (A) the acquisition of all of the capital stock or other equity interest in a Person (c) The following definitions of "GP LLC" and "Plains Newco LLC" are hereby added to Section 1.1 of the Original Agreement, for placement in alphabetical order in relation to the other definitions in Section 1.1, to read as follows: "GP LLC" means Plains All American GP LLC, a Delaware limited liability company. "Plains Newco LLC" means a Delaware limited liability company or other entity that is wholly-owned, directly or indirectly, by Plains MLP that is or may become the general partner of US Borrower and All American. (S) 2.3. Limitation on Issuance of Securities. The reference to "to such Restricted Person, to Plains MLP or to General Partner" set forth in the fourth sentence of Section 7.4 of the Original Agreement is hereby amended to refer instead to "to such Restricted Person or to Plains MLP". (S) 2.4. Limitation on Dividends and Redemptions. The reference to ", and to the General Partner pursuant to and in accordance with such Subsidiary's partnership agreement" set forth in clause (i) of Section 7.6 of the Original Agreement is hereby deleted. (S) 2.5. Events of Default. The references to "General Partner" set forth in clauses (i) and (j) of Section 8.1 of the Original Agreement are hereby amended to refer instead to "GP LLC or General Partner". (S) 2.6. Consents re: PAAI Sale Transaction. As generally set forth in Plains MLP's Form 8-K and Plains Resources Inc.'s Form 8-K, each filed with the Securities and Exchange Commission on May 10, 2001, Plains Resources Inc. ("Resources"), PAAI LLC and PAAI, the sole general partner of Plains MLP, Borrower and All American as of the date hereof, have entered into one or more agreements providing in part for the sale and transfer by PAAI of a portion of its general partner interest in Plains MLP and by PAAI LLC of certain of its 3 subordinated interests in Plains MLP (together with all other transfers contemplated in connection therewith, the "PAAI Sale Transaction"). To the extent any transfer pursuant to the PAAI Sale Transaction shall, for the purpose of Section 7.4 of the Credit Agreement, constitute the issue of any security, then such issuance may violate Section 7.4 of the Credit Agreement, which would constitute an Event of Default under Section 8.1(d) of the Credit Agreement. Lenders hereby consent to such issuance and waive any violation of Section 7.4 of the Credit Agreement or Event of Default caused thereby. Additionally, pursuant to the PAAI Sale Transaction, one or more Restricted Persons may enter into transitional agreements with Resources and/or other Affiliates of such Restricted Persons with respect to certain management and operational matters, and such transactions with such Affiliates may violate Section 7.9 of the Credit Agreement, which would constitute an Event of Default under Section 8.1(d) of the Credit Agreement . Lenders hereby consent to Restricted Persons' entry into such transitional agreements with such Affiliates and waive any violation of Section 7.9 of the Credit Agreement or Event of Default caused thereby; provided, such transitional agreements shall be on terms which are no less favorable to such Restricted Persons than those which would have been obtainable at the time in arm's-length transactions with Persons other than such Affiliates. (S)2.7. Waiver and Consent re: Restructuring. PAAI and Plains MLP may, prior to the effectivness of this Amendment, restructure the general partner interests in US Borrower and All American such that a direct or indirect wholly- owned Subsidiary of Plains MLP will hold such general partner interests, which would constitute a Change of Control under the Original Agreement and an Event of Default under Section 8.1(k) of the Original Agreement. Lenders hereby consent to any such restructuring prior to the effectiveness of this Amendment and waive any Change of Control and Event of Default under Section 8.1(k) of the Original Agreement caused thereby. ARTICLE III. -- Conditions of Effectiveness (S) 3.1. Effective Date. This Amendment, other than the waiver set forth in Section 2.7 hereof, shall become effective on the closing date provided for in the agreements governing the PAAI Sale Transaction contemporaneous with such closing (and the waiver set forth in Section 2.7 hereof shall become effective as of the date hereof), when and only when (i) Administrative Agent shall have received, at Administrative Agent's office, a counterpart of this Amendment executed and delivered by Borrower, Plains MLP, All American and Majority Lenders, (ii) Administrative Agent shall have additionally received all of the following documents, each document (unless otherwise indicated) being dated the date of receipt thereof by Administrative Agent, duly authorized, executed and delivered, and in form and substance satisfactory to Administrative Agent: (A) Officer's Certificate. A certificate of a duly authorized officer of General Partner, to the effect that all of the representations and warranties set forth in Article IV hereof are true and correct at and as of the date thereof, and (B) Supporting Documents. Such supporting documents as Administrative Agent may reasonably request. 4 ARTICLE IV. -- Representations and Warranties (S) 4.1. Representations and Warranties of Plains MLP and Borrowers. In order to induce Administrative Agent and Lenders to enter into this Amendment, Plains MLP and Borrowers represent and warrant to Administrative Agent and each Lender that: (a) The representations and warranties contained in Article V of the Original Agreement are true and correct at and as of the time of the effectiveness hereof, except to the extent that such representation and warranty was made as of a specific date. (b) Each Restricted Person is duly authorized to execute and deliver this Amendment and each other Amendment Document, to the extent a party thereto, and each Borrower is and will continue to be duly authorized to borrow and perform its obligations under the Credit Agreement. Each Restricted Person has duly taken all action necessary to authorize the execution and delivery of this Amendment and each other Amendment Document, to the extent a party thereto, and to authorize the performance of their respective obligations hereunder. (c) The execution and delivery by each Restricted Person of this Amendment and each other Amendment Document, to the extent a party thereto, the performance by each Restricted Person of its respective obligations hereunder and thereunder, and the consummation of the transactions contemplated hereby and thereby, do not and will not conflict with any provision of any Law or of the organizational documents of any Restricted Person, or of any material agreement, judgment, license, order or permit applicable to or binding upon any Restricted Person, or result in the creation of any Lien upon any assets or properties of any Restricted Person, except in favor of Administrative Agent for the benefit of Lenders and other Permitted Liens. Except for those which have been duly obtained, no consent, approval, authorization or order of any Tribunal or third party is required in connection with the execution and delivery by any Restricted Person of this Amendment or any other Amendment Document, or to consummate the transactions contemplated hereby and thereby. (d) When duly executed and delivered, each of this Amendment and each other Amendment Document, and each of the Loan Documents, as amended hereby and thereby, will be a legal and binding instrument and agreement of each Restricted Person to the extent a party thereto, enforceable in accordance with its terms, (subject, as to enforcement of remedies, to applicable bankruptcy, insolvency and similar laws applicable to creditors' rights generally). ARTICLE V. -- Miscellaneous (S) 5.1. Ratification of Agreements. The Original Agreement, as hereby amended, is hereby ratified and confirmed in all respects. The Loan Documents (including but not limited to each Guaranty), as they may be amended or affected by this Amendment or any other Amendment Document, are hereby ratified and confirmed in all respects by each Restricted Person to the extent a party thereto. Any reference to the Credit Agreement in any Loan 5 Document shall be deemed to refer to this Amendment also. The execution, delivery and effectiveness of this Amendment and the other Amendment Documents shall not, except as expressly provided herein, operate as a waiver of any right, power or remedy of Administrative Agent or any Lender under the Credit Agreement or any other Loan Document nor constitute a waiver of any provision of the Credit Agreement or any other Loan Document. (S) 5.2. Ratification of Security Documents. Restricted Persons, Administrative Agent, and Lenders each acknowledge and agree that any and all indebtedness, liabilities or obligations arising under or in connection with the LC Obligations or the Notes are Obligations and are secured indebtedness under, are guarantied by, and are secured by, each and every Security Document to which any Restricted Person is a party. Each Restricted Person hereby re-pledges, re- grants and re-assigns a security interest in and lien on every asset of the such Restricted Person described as Collateral in any Security Document and re- guarantees all Obligations, as amended hereby. (S) 5.3. Ratification of Intercreditor Agreement. Each Lender hereby acknowledges and confirms that all Obligations under the Credit Agreement, as amended hereby, and the "Obligations" under the Marketing Credit Agreement, as amended on the date hereof, shall be and shall remain subject to the terms and entitled to the benefits of the Intercreditor Agreement. (S) 5.4. Survival of Agreements. All representations, warranties, covenants and agreements of the Restricted Persons herein shall survive the execution and delivery of this Amendment and the performance hereof, including without limitation the making or granting of each Loan, and shall further survive until all of the Obligations are paid in full. All statements and agreements contained in any certificate or instrument delivered by any Restricted Person hereunder or under the Credit Agreement to Administrative Agent or any Lender shall be deemed to constitute representations and warranties by, or agreements and covenants of, such Restricted Person under this Amendment and under the Credit Agreement. (S) 5.5. Loan Documents. This Amendment and each other Amendment Document is a Loan Document, and all provisions in the Credit Agreement pertaining to Loan Documents apply hereto. (S) 5.6. GOVERNING LAW. THIS AMENDMENT SHALL BE GOVERNED BY AND CONSTRUED IN ACCORDANCE WITH THE LAWS OF THE STATE OF NEW YORK AND ANY APPLICABLE LAWS OF THE UNITED STATES OF AMERICA IN ALL RESPECTS, INCLUDING CONSTRUCTION, VALIDITY AND PERFORMANCE. (S) 5.7. Counterparts. This Amendment may be separately executed in counterparts and by the different parties hereto in separate counterparts, each of which when so executed shall be deemed to constitute one and the same Amendment. 6 IN WITNESS WHEREOF, this Amendment is executed as of the date first above written. BORROWER: PLAINS MARKETING, L.P. By: Plains All American Inc., General Partner By: ----------------------------------------------- Phil Kramer, Exec. Vice President GUARANTORS: ALL AMERICAN, L.P. PLAINS ALL AMERICAN PIPELINE, L.P. By: Plains All American Inc., General Partner By: ----------------------------------------------- Phil Kramer, Exec. Vice President 7 LENDER PARTIES: FLEET NATIONAL BANK, Administrative Agent, LC Issuer and Lender By: -------------------------------------------- Terrence Ronan, Managing Director FIRST UNION NATIONAL BANK, Lender By: -------------------------------------------- Robert R. Wetteroff, Sr. Vice Pres. BANK OF AMERICA, N.A., Lender By: --------------------------------------------- Name: Title: BANK ONE, NA (MAIN OFFICE CHICAGO), Lender By: --------------------------------------------- Name: Title: FORTIS CAPITAL CORP., Lender By: --------------------------------------------- Name: Title: By: --------------------------------------------- Name: Title: U.S. BANK NATIONAL ASSOCIATION, Lender By: --------------------------------------------- Name: Title: BANK OF SCOTLAND, Lender By: --------------------------------------------- Name: Title: 8 WELLS FARGO BANK (TEXAS), NATIONAL ASSOCIATION, Lender By: --------------------------------------------- Name: Title: THE BANK OF NOVA SCOTIA, Lender By: --------------------------------------------- Name: Title: CREDIT AGRICOLE INDOSUEZ, Lender By: --------------------------------------------- Name: Title: By: --------------------------------------------- Name: Title: TORONTO DOMINION (TEXAS), INC., Lender By: --------------------------------------------- Name: Title: SOUTHWEST BANK OF TEXAS, N.A., Lender By: --------------------------------------------- Name: Title: UNION BANK OF CALIFORNIA, N.A., Lender By: --------------------------------------------- Name: Title: 9 COMERICA BANK-TEXAS, Lender By: --------------------------------------------- Name: Title: BNP PARIBAS, Lender By: --------------------------------------------- Name: Title: By: --------------------------------------------- Name: Title: GUARANTY BANK, Lender By: --------------------------------------------- Name: Title: SIEMENS FINANCIAL SERVICES INC., Lender By: --------------------------------------------- Name: Title: 10 CONSENT AND AGREEMENT Each of the undersigned hereby consents to the provisions of this Amendment and the transactions contemplated herein and hereby (i) acknowledges and agrees that any and all indebtedness, liabilities or obligations arising under or in connection with the Notes are Obligations and are secured indebtedness under, and are secured by, each and every Security Document to which it is a party, (ii) re-pledges, re-grants and re-assigns a security interest in and lien on all of its assets described as collateral in any Security Document, (iii) ratifies and confirms its Guaranty dated May 4, 2001 made by it for the benefit of Administrative Agent and Lenders, and (iv) expressly acknowledges and agrees that the undersigned guarantees all indebtedness, liabilities and obligations arising under or in connection with any and all Notes pursuant to the terms of such Guaranty, and agrees that its obligations and covenants thereunder are unimpaired hereby and shall remain in full force and effect. PLAINS MARKETING CANADA LLC By: Plains Marketing, L.P., its sole member By: Plains All American Inc., its general partner By: ---------------------------------------- Phil Kramer, Exec. Vice President PMC (NOVA SCOTIA) COMPANY By: ---------------------------------------------- Phil Kramer, Exec. Vice President PLAINS MARKETING CANADA, L.P. By: PMC (Nova Scotia) Company, General Partner By: ---------------------------------------------- Phil Kramer, Exec. Vice President 11