EXHIBIT 10.5 FOURTH AMENDMENT TO AMENDED AND RESTATED CREDIT AGREEMENT (REVOLVING CREDIT AGREEMENT) THIS FOURTH AMENDMENT TO AMENDED AND RESTATED CREDIT AGREEMENT (REVOLVING CREDIT AGREEMENT) (herein called this "Amendment"), dated effective as of May 22, 2003, is entered into by and among W&T OFFSHORE, INC., a Nevada corporation, as the borrower (the "Borrower"), the various financial institutions parties hereto, as lenders (collectively, the "Lenders"), THE TORONTO-DOMINION BANK, as issuer of Letters of Credit (in such capacity together with any successors thereto, the "Issuer"), and TORONTO DOMINION (TEXAS), INC., individually and as agent (in such capacity together with any successors thereto, the "Agent") for the Lenders. Terms defined in the Revolving Credit Agreement (as hereinafter defined) are used herein with the same meanings as given them therein, unless the context otherwise requires. W I T N E S S E T H WHEREAS, the Borrower, the Lenders (or their predecessors-in-interest) and the Agent have heretofore entered into that certain Amended and Restated Credit Agreement, dated as of February 24, 2000, as amended pursuant to that certain First Amendment to Amended and Restated Credit Agreement dated as of December 5, 2000, among the Borrower, the Lenders, the Issuer and the Agent, as further amended pursuant to that certain Second Amendment to Amended and Restated Credit Agreement (Revolving Credit Agreement) dated effective as of May 31, 2002, as further amended pursuant to that certain Third Amendment to Amended and Restated Credit Agreement (Revolving Credit Agreement) dated effective as of December 2, 2002, among the Borrower, the Lenders, the Issuer and the Agent (as so amended, and as from time to time amended, supplemented, restated or otherwise modified, including pursuant to this Amendment, the "Revolving Credit Agreement"), pursuant to which the Lenders and Issuer have agreed to make Loans to the Borrower or issue or participate in Letters of Credit on behalf of the Borrower; and WHEREAS, the Borrower, the Lenders, the Issuer and the Agent intend to amend the Revolving Credit Agreement to provide for, among other things, an adjustment to the current Borrowing Base, an increase in the availability of Letters of Credit, an amendment to the calculation of commitment fees, and a consent to the making of an additional dividend by the Borrower to its shareholders, all as hereinafter provided; WHEREAS, subject to the terms and conditions of this Amendment, the parties hereto are willing to enter into this Amendment; NOW, THEREFORE, in consideration of the premises and the mutual agreements herein contained, the Borrower, the Lenders, the Issuer and the Agent hereby agree as follows: 1. Amendments to Revolving Credit Agreement. The Revolving Credit Agreement is amended as follows: (a) Amendment of Section 1.1. (i) The definition of "Commitment Fee Rate" in Section 1.1 of the Revolving Credit Agreement is amended hereby in its entirety to read as follows: "Commitment Fee Rate" means, on each day: (a) three-eighths of one percent (0.375%) per annum when the Facility Usage on such day is less than ninety percent (90%) of the Borrowing Base on such day, and (b) one-half of one percent (0.50%) per annum when the Facility Usage on such day is greater than or equal to ninety percent (90%) of the Borrowing Base on such day. (ii) The definition of "Issuer" in Section 1.1 of the Revolving Credit Agreement is hereby amended in its entirety to read as follows: "Issuer" means The Toronto-Dominion Bank, Bank One, NA (Main Office - Chicago) or Fortis Capital Corp., or any other Lender which has agreed to issue one or more Letters of Credit at the request of the Agent (which shall, at the Borrower's request, notify the Borrower from time to time of the identity of such other Lender); provided that no Issuer without its consent shall be required to have outstanding at any time Letters of Credit issued by such Issuer having a face amount of more than $30,000,000 in the aggregate. (iii) The definitions of "Adjusted Net Income After Permitted Tax Distributions" and "Permitted Tax Distributions" in Section 1.1 of the Revolving Credit Agreement are hereby deleted in their entirety. (b) Amendment of Section 2.1(b)(iii). Clause (b)(iii) of Section 2.1 of the Revolving Credit Agreement is amended hereby in its entirety to read as follows: "(iii) all Letter of Credit Outstandings would exceed $90,000,000." (c) Amendment of Section 2.5(a). Section 2.5(a) of the Revolving Credit Agreement is amended hereby in its entirety to read as follows: "(a) Commitment Fees. In consideration of each Lender's commitment to make Loans, Borrower will pay to Agent for the account of each Lender a commitment fee determined on a daily basis by applying the Commitment Fee Rate to such Lender's Percentage Share of the unused portion of the Borrowing Base on each day during the Commitment Period, determined for each such day by deducting from the amount of the Borrowing Base at the end of such day the Facility Usage. This commitment fee will be due and payable in arrears on each ABR Payment Date and at the end of the Commitment Period." (d) Amendment of Section 2.5(d). Section 2.5(d) of the Revolving Credit Agreement is amended by replacing the reference to "0.0625%" with a reference to "0.125%". 2 (e) Amendment of Section 2.11(a)(i)(2). Clause (a)(i)(2) of Section 2.11 of the Revolving Credit Agreement is amended hereby in its entirety to read as follows: "(3) together with all Letter of Credit Outstandings would not exceed $90,000,000;" (f) Amendment of Section 7.6. Section 7.6 of the Credit Agreement is hereby amended in its entirety as follows: "Section 7.6 Limitation on Distributions; Redemptions and Prepayments of Indebtedness. No Restricted Person will make any Distribution, except as expressly provided in this section, and no Restricted Person will redeem, purchase, prepay or defease any Indebtedness, other than the Obligations, prior to the original maturity thereof. Distributions may be made: (i) by Borrower to any of its shareholders on any date in an amount not to exceed the Available Distribution Amount, or (ii) by Subsidiaries of Borrower without limitation to Borrower; or (iii) by Borrower to its shareholders, provided that (a) the amount of all Distributions pursuant to this Section 7.6(iii) during such year and any Equity Investments during such year do not, in the aggregate, exceed $10,000,000 per year, (b) such Distribution occurs within thirty (30) days of the receipt by Agent of updated monthly financial reports in form and substance satisfactory to Agent, in its sole discretion, accompanied by a certificate of an authorized officer of the Borrower certifying to the truth, correctness and completeness of such reports, (c) the ratio of (X) EBITDA to (Y) Consolidated Interest of Borrower for the Four Quarter Period then ended shall not be less than 8.0 to 1.0, and (d) after giving effect to such Distribution, the Facility Usage on such date is less than seventy-five percent (75%) of the Borrowing Base on such date; provided, that the computation of the amount of any such Distribution described in clauses (i), (ii) and (iii) above shall have been proven by Borrower to the reasonable satisfaction of Agent, and, provided further that no such Distribution described in clauses (i), (ii) and (iii) above shall be permitted if (a) an Event of Default has occurred and is continuing, (b) an Event of Default would occur as a result of such Distribution, or (c) a Borrowing Base Deficiency exists." (g) Amendment of Section 7.7. The last sentence of Section 7.7 of the Credit Agreement is hereby amended by inserting the word "and" in front of clause (d) and by deleting clause (e) thereof: (h) Redetermination of the Borrowing Base. As of the Effective Date, the parties hereto agree that the Borrowing Base shall be $170,000,000 until such time as the Borrowing Base is redetermined in accordance with the Credit Agreement. 3 2. Representations and Warranties. To induce each Lender Party to enter into this Amendment, the Borrower hereby reaffirms, as of the date hereof, its representations and warranties contained in the Revolving Credit Agreement (except to the extent such representations and warranties relate solely to an earlier date, in which case such representations and warranties shall be true, correct and complete as of such earlier date) and additionally represents and warrants as follows: (a) Due Incorporation, Etc. The Borrower (i) is a corporation duly organized, validly existing and in good standing under the laws of the State of Nevada, (ii) has all requisite corporate power and authority to own its assets and to carry on its business as now conducted and proposed to be conducted, (iii) is duly qualified to do business and is in good standing in all other jurisdictions where the nature of its business requires it to be so qualified and where the failure to so qualify would materially and adversely affect the business, assets, properties or condition (financial and otherwise), of the Borrower. (b) Non-Contravention. The execution, delivery and performance by the Borrower of this Amendment are within the Borrower's corporate powers, have been duly authorized by all necessary action of the Borrower, require, in respect of the Borrower, no action by or in respect of, or filing with, any governmental authority which has not been performed or obtained and do not contravene, or constitute a default under, any provision of Law or regulation (including, without limitation, Regulation X issued by the Board of Governors of the Federal Reserve System applicable to the Borrower or Regulation U issued by the Board of Governors of the Federal Reserve System) or the articles of incorporation or the bylaws of the Borrower or any agreement, judgment, injunction, order, decree or other instrument binding upon the Borrower or result in the creation or imposition of any Lien on any asset of the Borrower except as contemplated by the Loan Documents. (c) Legal, Valid and Binding. This Amendment is a legal, valid and binding obligation of the Borrower enforceable against the Borrower in accordance with its terms. 3. Effectiveness. This Amendment shall be effective as of May , 2003, -- following the satisfaction of the following conditions (the "Effective Date"): (a) the Agent's receipt of this Amendment, duly executed by each of the parties hereto; (b) payment of all expenses and fees, if any, then due and payable to the Agent and Lenders pursuant to the Loan Documents; and (c) such other documents or agreements as the Agent may reasonably request prior to the Effective Date in connection with the execution of this Amendment. 4. Ratification of Amendment. This Amendment shall be deemed to be an amendment to the Revolving Credit Agreement, and the Revolving Credit Agreement, as amended hereby, is hereby ratified, approved and confirmed in each and every respect. All references to the Revolving Credit Agreement in any other document, instrument, agreement or writing shall hereafter be deemed to refer to the Revolving Credit Agreement as amended hereby. This Amendment is a Loan Document. 4 5. Limited Consent to Additional Dividend in 2003. The Borrower represents and warrants that it has heretofore made a dividend in the amount of $10,000,000 during the 2003 fiscal year in compliance with the requirements of Section 7.6(iii) of the Credit Agreement. The Agent and Lenders hereby consent to the Borrower's making in the fiscal year 2003, an additional dividend to its shareholders in an amount not to exceed $2,000,000 in the aggregate for the purpose of reducing such shareholders' tax basis in the stock of the Borrower in connection with the Borrower's conversion from an S Corporation into a C Corporation; provided, however, that such additional dividend shall be subject to, and the Borrower shall satisfy and be in compliance with the requirements of, clauses (iii)(b), (iii)(c), (iii)(d) and (iii)(e) of Section 7.6 of the Credit Agreement and to the provisos at the end of such Section 7.6. 6. GOVERNING LAW. THIS AMENDMENT SHALL BE DEEMED A CONTRACT AND INSTRUMENT MADE UNDER THE LAWS OF THE STATE OF TEXAS AND SHALL BE CONSTRUED AND ENFORCED IN ACCORDANCE WITH AND GOVERNED BY THE LAWS OF THE STATE OF TEXAS AND THE LAWS OF THE UNITED STATES OF AMERICA, WITHOUT REGARD TO PRINCIPLES OF CONFLICTS OF LAW. 7. Severability. Any provision of this Amendment that is prohibited or unenforceable in any jurisdiction shall, as to such provision and such jurisdiction, be ineffective to the extent of such prohibition or unenforceability without invalidating the remaining provisions of this Amendment or affecting the validity or enforceability of such provision in any other jurisdiction. 8. Counterparts. This Amendment may be executed in any number of counterparts, all of which taken together shall constitute one and the same instrument, and any party hereto may execute this Amendment by signing one or more counterparts. Any signature hereto delivered by a party by facsimile transmission shall be deemed to be an original signature hereto. 9. Successors and Assigns. This Amendment shall be binding upon the Borrower and its successors and permitted assigns and shall inure, together with all rights and remedies of each Lender Party hereunder, to the benefit of each Lender Party and the respective successors, transferees and assigns. [Remainder of page intentionally blank] 5 EXHIBIT 10.5 IN WITNESS WHEREOF, the parties hereto have caused this Amendment to be executed by their respective officers thereunto duly authorized as of the day and year first above written. BORROWER: W&T OFFSHORE, INC., a Nevada corporation By: /s/ W. Reid Lea ------------------------------------ Name: W. Reid Lea Title: Chief Financial Officer AGENT: TORONTO DOMINION (TEXAS), INC., as Agent By: /s/ Neva Nesbitt ------------------------------------ Name: Neva Nesbitt Title: Vice President ISSUER: THE TORONTO-DOMINION BANK, as Issuer By: /s/ Neva Nesbitt ------------------------------------ Name: Neva Nesbitt Title: Manager Syndications & Credit Admin. LENDERS: TORONTO DOMINION (TEXAS), INC., as Lender By: /s/ Neva Nesbitt ------------------------------------ Name: Neva Nesbitt Title: Vice President BANK ONE, NA (Main Office - Chicago), as Lender By: /s/ Thomas Okamoto ------------------------------------ Name: Thomas E. Okamoto Title: Associate Director FORTIS CAPITAL CORP., as Lender By: /s/ Christopher S. Parada ------------------------------------ Name: Christopher S. Parada Title: Vice President By: /s/ Darrell W. Holley ------------------------------------ Name: Darrell W. Holley Title: Managing Director BANK OF SCOTLAND, as Lender By: /s/ Joseph Fratus ------------------------------------ Name: Joseph Fratus Title: First Vice President BMO NESBITT BURNS FINANCING, INC., as Lender By: /s/ James B. Whitmore ------------------------------------ Name: James B. Whitmore Title: Managing Director NATEXIS BANQUES POPULAIRES, as Lender By: /s/ Donovan C. Broussard ------------------------------------ Name: Donovan C. Broussard Title: Vice President and Manager By: /s/ Philippe Robin ------------------------------------ Name: Philippe Robin Title: Senior Vice President ROYAL BANK OF CANADA, as Lender By: /s/ Lorne Gartner ------------------------------------ Name: Lorne Gartner Title: Vice President