EX-5.1 4 a2127865zex-5_1.htm EXHIBIT 5.1
QuickLinks -- Click here to rapidly navigate through this document


EXHIBIT 5.1

LEGAL OPINION

March 8, 2004

Board of Directors
MainSource Financial Group, Inc.
201 North Broadway
Greensburg, Indiana 47240

    RE:
    Issuance of Shares of Common Stock of MainSource Financial Group, Inc. in connection with the Acquisition of Peoples Financial Corp.

Ladies and Gentlemen:

        We have represented MainSource Financial Group, Inc. ("MainSource"), Greensburg, Indiana, as special counsel in connection with the preparation and filing of a Registration Statement on Form S-4 (the "Registration Statement") with the Securities and Exchange Commission for the purpose of registering shares of MainSource's no par value common stock under the Securities Act of 1933, as amended (the "Shares"). The Shares are to be issued to shareholders of Peoples Financial Corp. ("Peoples"), in connection with the proposed affiliation of Peoples and MainSource, as specified in the Amended and Restated Reorganization and Plan of Merger, effective as of December 16, 2003 (the "Agreement"), by and among MainSource, Peoples and Peoples Holdings, Inc. ("Peoples Holdings"), through which Peoples Holdings will merger into Peoples and, immediately thereafter, Peoples will merge into MainSource (the "Merger"). The Merger will be accomplished and the Shares will be issued pursuant to the specific terms of the Agreement. In connection with this opinion, we have reviewed and are familiar with MainSource's Articles of Incorporation and By-Laws and such other records, documents and information as we have in our judgment deemed relevant.

        Based upon the foregoing, it is our opinion that if and when the Merger is consummated, the Shares will, when issued to shareholders of Peoples in accordance with all of the terms and conditions of the Agreement, be legally issued, fully paid and non-assessable. This opinion is limited to the matters stated herein, and no opinion is to be implied or may be inferred beyond the matters expressly stated.

        This opinion is addressed to you and is solely for your use in connection with the Registration Statement, and we assume no professional responsibility to any other person whatsoever. Accordingly, the opinion expressed herein is not to be relied upon, utilized or quoted by or delivered or disclosed to, in whole or in part, any other person, corporation, entity or governmental authority without, in each instance, the prior written consent of this firm.

        We hereby consent to the use of this opinion as an exhibit to the Registration Statement and to the reference made to us in the Registration Statement and the Prospectus forming a part thereof under the caption "Legal Matters". In giving this consent, we do not thereby admit that we come within the category of persons whose consent is required under Section 7 of the Securities Act of 1933, as amended, or the Rules and Regulations of the Securities and Exchange Commission promulgated thereunder.

    Very truly yours,

 

 

/s/ KRIEG DeVAULT LLP

KRIEG DeVAULT LLP



QuickLinks

LEGAL OPINION