Exhibit 5.1 [Letterhead of Greenebaum Doll & McDonald PLLC] January 11, 2002 Community Trust Bancorp, Inc. CTBI Preferred Capital Trust II 346 North Mayo Trail Pikeville, Kentucky 41501 Ladies and Gentlemen: We have acted as counsel for Community Trust Bancorp, Inc., a Kentucky corporation (the "Company"), and CTBI Preferred Capital Trust II, a statutory business trust created under the laws of Delaware (the "Trust"), in connection with the preparation and filing of a Registration Statement on Form S-3 (the "Registration Statement"), filed with the Securities and Exchange Commission (the "Commission") on January 11, 2002, under the Securities Act of 1933, as amended (the "Act"), for the purpose of registering (i) 1,000,000 preferred securities to be issued by the Trust (the "Preferred Securities"), (ii) subordinated debt securities to be issued by the Company to the Trust (the "Subordinated Debentures"), and (iii) the Company's guarantee (the "Guarantee") which guarantees the payment of distributions and payments on liquidation or redemption of the Preferred Securities, to be issued by the Company to the Trust in connection with such issuance of the Preferred Securities. In rendering this opinion, we have examined originals or copies, certified or otherwise identified to our satisfaction, of (i) the Certificate of Trust of the Trust dated as of January 7, 2002; (ii) the form of Amended and Restated Trust Agreement of the Trust; (iii) the form of Preferred Securities Certificate of the Trust; (iv) the form of Preferred Securities Guarantee Agreement for the Trust; (v) the form of Subordinated Debenture; and (vi) the form of Indenture for the Subordinated Debentures (the "Indenture"), all in the forms filed as exhibits to the Registration Statement. 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 for purposes of rendering 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 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 Certificate of the Trust, the Guarantee, the Subordinated Debentures and the Indenture will be executed in substantially the form reviewed by us. As to any facts material to the opinions expressed herein which were not independently established or verified, we have relied upon factual statements and factual representations of officers, trustees and other representatives of the Company and the Trust, and others. Based upon and subject to the foregoing and to the other qualifications and limitations set forth herein, we are of the opinion that: 1. The Subordinated Debentures have been duly authorized by all requisite corporate action of the Company and, 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. 2. The Guarantee has been duly authorized by all requisite corporate action and, upon the issuance of the Preferred Securities in the manner and upon the terms described in the Registration Statement, 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. The foregoing opinions are expressly subject to (and conditioned strictly upon) the following qualifications and limitations: a. Statements in this opinion as to the validity, binding effect and enforceability of certain documents are subject to (i) limitations as to enforceability imposed by bankruptcy, reorganization, fraudulent conveyance or transfer, moratorium, insolvency and other laws and matters of public policy now or hereafter in effect relating to or affecting the enforceability of creditors' rights generally, and (ii) equitable principles limiting the availability of equitable remedies. b. Our opinion is based solely on and limited to the laws of the Commonwealth of Kentucky. We express no opinion as to the laws of any other jurisdiction. c. The information and opinions set forth above are as of the date hereof, and we disclaim any undertaking to advise you of changes that hereafter may be brought to our attention. We hereby consent to the use of our name under the caption "Legal Matters" in the Prospectus and the filing of this opinion with the Commission as an exhibit to the Registration Statement. In giving this consent, we do not hereby concede that we are within the category of persons whose consent is required under Section 7 of the Act or the rules and regulations of the Commission promulgated thereunder. Yours very truly, /s/ Greenebaum Doll & McDonald PLLC Greenebaum Doll & McDonald PLLC