EXHIBIT 5 REITNER & STUART A PARTNERSHIP OF PROFESSIONAL CORPORATIONS ATTORNEYS AT LAW 1319 Marsh Street San Luis Obispo, CA 93401 Tel: (805) 545-8590 Fax: (805) 545-8599 BARNET REITNER* WASHINGTON D.C. OFFICE: JOHN F. STUART 1730 K STREET, N.W., 11TH FLOOR - ------------------------ WASHINGTON, D.C. 20006 *ADMITTED ONLY IN CALIFORNIA TEL (202) 466-2818 FAX (202) 466-3535 June 30, 1997 Heritage Oaks Bancorp 545 12th Street Paso Robles, California 93446 Re: Registration Statement on Form S-8 Gentlemen: At your request, we have examined the Registration Statement on Form S-8 (the "Registration Statement") being filed by Heritage Oaks Bancorp (the "Company") with the Securities and Exchange Commission in connection with the registration under the Securities Act of 1933, as amended, of 107,366 shares of the Company's common stock, (the "Common Stock"), issuable pursuant to stock grants or upon the exercise of stock options granted pursuant to the Company's 1997 Stock Option Plan (the "Plan"). In rendering this opinion, we have examined such documents and records as we have deemed relevant. We have assumed the genuineness of all signatures, the authenticity of all documents submitted to us as originals and the conformity to originals of all documents submitted to us as certified or reproduced copies. Based upon the foregoing and such other and further review of fact and law as we have deemed necessary or appropriate under the circumstances, and assuming that (i) all options granted under the Plan will be granted pursuant to the terms of the Plan, (ii) the consideration for the shares of Common Stock issued pursuant to the exercise of such options will be received prior to the issuance thereof and (iii) the shares of Common Stock issued pursuant to the exercise of such options will be issued in accordance with the terms of the Plan and the option agreements (as appropriate), upon which assumptions the following opinions are expressly conditioned, it is our opinion that the shares upon the exercise of options granted pursuant to the Plan and pursuant to the Registration Statement will, when sold in accordance with the terms of the Plan and the option agreements, be validly issued, fully paid and non-assessable. This opinion is issued to you solely for use in connection with the Registration Statement and is not to be quoted or otherwise referred to in any financial statements of the Company or related documents, nor is it to be filed with or furnished to any government agency or other person, without the prior written consent of this firm in each instance. Heritage Oaks Bancorp June 30, 1997 Page 2 This firm hereby consents to the filing of this opinion as an exhibit to the Registration Statement and to the reference to the undersigned under the heading "Legal Matters" therein and in any prospectus delivered to participants in the Plan and any amendments thereto. Respectfully submitted, /s/Reitner & Stuart REITNER & STUART JFS: wsm