<PAGE>

                                                                     Exhibit 5.1

                  [LETTERHEAD OF BOND, SCHOENECK & KING, PLLC]

March 12, 2004

Community Bank System, Inc.
5790 Widewaters Parkway
DeWitt, New York 13214

     Re: Community Bank System, Inc. / Registration Statement on Form S-4

Ladies and Gentlemen:

We have acted as counsel to Community Bank System, Inc., a Delaware corporation
(the "Company"), in connection with the preparation and filing of a registration
statement on Form S-4 (the "Registration Statement") under the Securities Act of
1933, as amended, covering up to an aggregate of 1,384,416 shares (together with
any additional shares to covered by the Registration Statement as a result of
certain changes in the capital stock of the Company as described in the table
captioned "Calculation of Registration Fee" on the cover page of the
Registration Statement) (collectively, the "Shares") of common stock, no par
value, of the Company to be issued pursuant to the merger described in the
Registration Statement (the "Merger").

As such counsel, we have examined the Registration Statement and the Agreement
and Plan of Merger, dated as of January 6, 2004, as amended, by and among the
Company, Community Bank, N.A., and First Heritage Bank (the "Merger Agreement"),
relating to the Merger, as well as such corporate records, certificates and
other documents and such questions of law as we have considered necessary or
appropriate for the purposes of this opinion. In rendering this opinion, we have
(a) assumed (i) the genuineness of all signatures on all documents examined by
us, (ii) the authenticity of all documents submitted to us as originals, and
(iii) the conformity to original documents of all documents submitted to us as
photostatic or conformed copies and the authenticity of the originals of such
copies; and (b) relied on (1) certificates of public officials and (2) as to
matters of fact, statements and certificates of officers of the Company.

Based on the foregoing, we are of the opinion that the Shares have been duly
authorized and, when issued to the holders of common stock, par value $10.00 per
share, of First Heritage Bank in accordance with the Merger Agreement, the
Shares will be validly issued, fully paid and non-assessable.

We are attorneys admitted to the Bar of the State of New York, and express no
opinion as to the laws of any jurisdiction other than the laws of the United
States of America and the State of Delaware.

<PAGE>

We consent to the filing of this opinion as an exhibit to the Registration
Statement and to the use of our name under the heading "Legal Matters" in the
proxy statement/prospectus forming a part of the Registration Statement. In
giving such consent we do not thereby concede that we are within the category of
persons whose consent is required under Section 7 of the Securities Act or the
rules or regulations promulgated thereunder.

Very truly yours,

/s/ BOND, SCHOENECK & KING, PLLC

