EXHIBIT 10.5.1 -------------- MAHASKA INVESTMENT COMPANY SECOND AMENDMENT TO AMENDED AND RESTATED CREDIT AGREEMENT Harris Trust and Savings Bank Chicago, Illinois Ladies and Gentlemen: Reference is hereby made to that certain Amended and Restated Credit Agreement dated as of June 30, 2000, as amended (the "Credit Agreement"), between the undersigned, Mahaska Investment Company, an Iowa corporation (the "Borrower"), and Harris Trust and Savings Bank (the "Bank"). All capitalized terms used herein without definition shall have the same meanings herein as such terms have in the Credit Agreement. The Borrower has requested that the Bank extend the Termination Date, amend the Non-Performing Assets ratio, and to waive the Borrower's non-compliance with certain covenants of the Credit Agreement and the Bank is willing to do so under the terms and conditions set forth in this agreement (herein, the "Amendment"). SECTION 1. AMENDMENTS. Subject to the satisfaction of the conditions precedent set forth in Section 2 below, the Credit Agreement shall be and hereby is amended as follows: 1.1. The definition of "Revolving Credit Termination Date" appearing in Section 4 of the Credit Agreement is hereby amended by striking the date "June 30, 2002" and inserting the date "September 30, 2003" in lieu thereof. 1.2. Section 7.6 of the Credit Agreement shall be amended in its entirety and as amended it shall be restated to read as follows: "Section 7.6. Non-Performing Assets. (a) (Consolidated). The Borrower shall, as of the last day of each fiscal quarter, maintain on a consolidated basis with its Subsidiaries (excluding, for purposes of this determination only, MIC as a Subsidiary of the Borrower), a ratio of (a) Non-Performing Assets of the Borrower on such consolidated basis to (b) the sum of (i) the stockholders' equity for the Borrower, plus (ii) loan loss reserves established by the Borrower on such consolidated basis in accordance with regulatory accounting principles applicable to the Borrower in an amount less than or equal to .35 to 1.0. (b) Banking Subsidiaries. The Borrower shall cause, as of the last day of each fiscal quarter, each Banking Subsidiary to maintain as of such day on an individual basis, a ratio of (a) Non-Performing Assets of such Banking Subsidiary after eliminating non performing loan pool items, to (b) the sum of (i) core capital for such Banking Subsidiary, plus (ii) loan loss reserves established by such Banking Subsidiary, in accordance with regulatory accounting principles applicable to such Banking Subsidiary in an amount less than or equal to .20 to 1.0. -1- SECTION 2. WAIVERS. 2.1. The Borrower has advised the Bank that as of January 31, 2002 the Borrower was not in compliance with Section 7.8 of the Credit Agreement (Return on Assets). Specifically, the Borrower's return on assets was .81%. The Borrower has requested that the Bank waive the Borrower's non-compliance with Section 7.8 of the Credit Agreement as of January 31, 2002, and by signing in the space provided for that purpose below, the Bank hereby agrees to waive compliance with the same for, and only for, the period ended on January 31, 2002. This waiver shall not become effective unless and until the conditions precedent set forth in Section 3 below have been satisfied. 2.2. The Borrower has advised the Bank as of January 31, 2002 the Borrower was not in compliance with Section 7.10 of the Credit Agreement (Dividends and Certain Other Restricted Payments). Specifically, the Borrower paid $2,400,000 in dividends and repurchased $820,000 of stock, totaling 73.3% of Consolidated Net Income. The Borrower has requested that the Bank waive the Borrower's non-compliance with Section 7.10 of the Credit Agreement as of January 31, 2002, and by signing in the space provided for that purpose below, the Bank hereby agrees to waive compliance with the same for, and only for, the period ended on January 31, 2002. This waiver shall not become effective unless and until the conditions precedent set forth in Section 3 below have been satisfied. SECTION 3. CONDITIONS PRECEDENT. The effectiveness of this Amendment is subject to the satisfaction of all of the following conditions precedent: 3.1. The Borrower and the Bank shall have executed and delivered this Amendment. 3.2. Legal matters incident to the execution and delivery of this Amendment shall be satisfactory to the Bank and its counsel. SECTION 4. REPRESENTATIONS. In order to induce the Bank to execute and deliver this Amendment, the Borrower hereby represents to the Bank that as of the date hereof the representations and warranties set forth in Section 5 of the Credit Agreement are and shall be and remain true and correct (except that the representations contained in Section 5.5 shall be deemed to refer to the most recent financial statements of the Borrower delivered to the Bank) and the Borrower is in compliance with the terms and conditions of the Credit Agreement and no Default or Event of Default has occurred and is continuing under the Credit Agreement or shall result after giving effect to this Amendment. SECTION 5. MISCELLANEOUS. 5.1. The Borrower heretofore executed and delivered to the Bank certain Collateral Documents. The Borrower hereby acknowledges and agrees that the Liens created and provided for by the Collateral Documents continue to secure, among other things, the Obligations arising under the Credit Agreement as amended hereby; and the Collateral Documents and the rights and remedies of the Bank thereunder, the obligations of the Borrower thereunder, and the Liens created and provided for thereunder remain in full force and effect and shall not be affected, impaired or discharged hereby. Nothing herein contained shall in any manner affect or impair the priority of the liens and security interests created and provided for by the Collateral Documents as to the indebtedness which would be secured thereby prior to giving effect to this Amendment. -2- 5.2. Except as specifically amended herein, the Credit Agreement shall continue in full force and effect in accordance with its original terms. Reference to this specific Amendment need not be made in the Credit Agreement, the Notes, or any other instrument or document executed in connection therewith, or in any certificate, letter or communication issued or made pursuant to or with respect to the Credit Agreement, any reference in any of such items to the Credit Agreement being sufficient to refer to the Credit Agreement as amended hereby. 5.3. The Borrower agrees to pay on demand all costs and expenses of or incurred by the Bank in connection with the negotiation, preparation, execution and delivery of this Amendment, including the fees and expenses of counsel for the Bank. 5.4. This Amendment may be executed in any number of counterparts, and by the different parties on different counterpart signature pages, all of which taken together shall constitute one and the same agreement. Any of the parties hereto may execute this Amendment by signing any such counterpart and each of such counterparts shall for all purposes be deemed to be an original. This Amendment shall be governed by the internal laws of the State of Illinois. This Second Amendment to Amended and Restated Credit Agreement is entered into as of this 15th day of October, 2002. MAHASKA INVESTMENT COMPANY By /s/ David A. Meinert -------------------- David A. Meinert Executive Vice-President and CFO Accepted and agreed to. HARRIS TRUST AND SAVINGS BANK By /s/ Robert Bomben -------------------- Robert Bomben Vice President -3-