EXHIBIT 5.1 [LETTERHEAD OF GREENEBAUM DOLL & MCDONALD PLLC] March 25, 1997 Community Trust Bancorp, Inc. 208 North Mayo Trail Pikeville, Kentucky 41501 Ladies and Gentlemen: We have acted as legal counsel to Community Trust Bancorp, Inc., a Kentucky corporation (the "Company"), and CTBI Preferred Capital Trust, a Delaware statutory business trust (the "Trust"), in connection with the preparation of a Registration Statement on Form S-3 under the Securities Act of 1933, as amended (the "Act"), filed by the Company and the Trust with the Securities and Exchange Commission (the "SEC") on March 25, 1997 (the "Registration Statement") for the purpose of registering under the Act Cumulative Trust Preferred Securities (the "Preferred Securities") issued by the Trust. Capitalized terms not defined herein shall have the meaning assigned to them in the Registration Statement. We have examined and are familiar with the (i) the certificate of trust of the Trust (the "Certificate of Trust") filed with the Secretary of State of the State of Delaware, (ii) the Amended and Restated Trust Agreement of the Trust, (iii) the form of the Preferred Securities of the Trust, (iv) the form of the Guarantee between the Company and State Street Bank and Trust Company, as trustee, (v) the form of the Subordinated Debentures to be issued by the Company, and (vi) the form of the subordinated debenture indenture (the "Indenture") between the Company and State Street Bank and Trust Company, as trustee. We have also examined originals or copies, certified, or otherwise identified to our satisfaction, of such other documents, certificates, and records as we have deemed necessary or appropriate as a basis for the opinions set forth herein. In our examination, we have assumed the legal capacity of all natural persons, the genuineness of all signatures, the authenticity of all documents submitted to us as originals, the conformity to original documents of all documents submitted to us as certified or photostatic copies and the authenticity of the originals of such copies. In making our examination of documents executed by parties other than the Company or the Trust, we have assumed that such parties had the power, corporate or other, to enter into and perform all obligations thereunder and have also assumed the due authorization by all requisite action, corporate or other, and execution and delivery by such parties of such documents and that, except as set forth in paragraphs (1) and (2) below, such documents constitute valid and binding obligations of such parties. In addition, we have assumed that the Amended and Restated Trust Agreement of the Trust, the Preferred Securities of the Trust, the Guarantee, the Subordinated Debentures and the Indenture when executed, will be executed in substantially the form reviewed by us with only such modifications which are accepted by us. As to any facts material to the opinions expressed herein which were not independently established or verified, we have relied upon oral or written statements and representations of officers, trustees, and other representatives of the Company, the Trust and others. Based upon and subject to the foregoing and to other qualifications and limitations set forth herein, we are of the opinion that: 1. After the Indenture has been duly executed and delivered, the Subordinated Debentures, when duly executed, delivered, authenticated and issued in accordance with the Indenture and delivered and paid for as contemplated by the Registration Statement, will be valid and binding obligations of the Company, entitled to the benefits of the Indenture and enforceable against the Company in accordance with their terms, except to the extent that enforcement thereof may be limited by (i) bankruptcy, insolvency, reorganization, moratorium, or other similar laws now or hereafter in effect relating to creditors' rights generally, and (ii) general principles of equity (regardless of whether enforceability is considered in a proceeding at law or in equity). 2. The Guarantee, when duly executed and delivered by the parties thereto, will be a valid and binding agreement of the Company, enforceable against the Company in accordance with its terms, except to the extent that enforcement thereof may be limited by (i) bankruptcy, insolvency, reorganization, moratorium, or other similar laws now or hereafter in effect relating to creditors' rights generally, and (ii) general principles of equity (regardless of whether enforceability is considered in a proceeding at law or in equity). We are members of the Bar of the Commonwealth of Kentucky. To the extent that laws other than the laws of the Commonwealth of Kentucky are applicable to any of the transactions, agreements, or instruments referred to herein, we express no opinion on such laws. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement, and with such state securities administrators as may require such opinion of counsel for the registration of the Preferred Securities and to the reference to this firm under the heading "Validity of Preferred Securities" in the Prospectus. In giving this consent, we do not thereby admit that we are within the category of persons whose consent is required under Section 7 of the Act or under the rules and regulations of the Securities and Exchange Commission thereunder. Very truly yours, /s/ Greenebaum Doll & McDonald PLLC Greenebaum Doll & McDonald PLLC 2