Exhibit 5.1 February 11, 1999 CCBT Bancorp, Inc. 307 Main Street Hyannis, MA 02601 Re: Registration Statement on Form S-8 ---------------------------------- Ladies and Gentlemen: This opinion is rendered to you in connection with the preparation of the Registration Statement on Form S-8 (the "Registration Statement") under the Securities Act of 1933, as amended (the "Securities Act") and the prospectus related thereto (the "Prospectus"), relating to an aggregate of 400,000 shares (the "Shares") of the common stock, $1.00 par value per share (the "Common Stock") of CCBT Bancorp, Inc. (the "Company") consisting of 400,000 shares issuable upon exercise of options underlying the CCBT Bancorp, Inc. Stock Option Plan, as amended and restated to the date hereof. We have acted as counsel to the Company in connection with the preparation of the Registration Statement. For purposes of this opinion, we have examined the Articles of Organization and By-laws of the Company; such records of the corporate proceedings of the Company as we have deemed material; the Registration Statement and all exhibits thereto; the CCBT Bancorp Inc. Stock Option Plan, as amended, and such other documents as we have deemed necessary to enable us to render this opinion. We are attorneys admitted to practice in The Commonwealth of Massachusetts. We express no opinion concerning the laws of any jurisdiction other than the laws of the United States of America and The Commonwealth of Massachusetts. In rendering the opinions expressed herein, we assume that all steps necessary to comply with the registration requirements of the Securities Act and with applicable requirements of state law regulating the sale of securities will be duly taken. Based upon and subject to the foregoing, and having regard for such legal considerations as we have deemed relevant, it is our opinion that the Shares have been authorized for issuance and, when issued and delivered against payment of the consideration therefor as set forth in the Prospectus, will be validly issued, fully paid and nonassessable. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement and to the reference to our name in the Registration Statement and the Prospectus contained therein. Very truly yours, /s/Goodwin, Procter & Hoar LLP GOODWIN, PROCTER & HOAR LLP 8