1 EXHIBIT 5 OPINION OF REITNER & STUART RELATING TO THE LEGALITY OF SECURITIES BEING REGISTERED, AND CONSENT PAGE 39 OF 43 2 [LETTERHEAD] 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 88,873 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 1990 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) stock grants and all options granted under the Plan to date have been 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 has been or will be received prior to the issuance thereof and (iii) the shares of Common Stock issued pursuant to the exercise of such options have been or 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. 3 [LETTERHEAD] Heritage Oaks Bancorp June 25,1996 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 to heading "Legal Matters" and in any prospectus delivered to participants in the Plan and any amendments thereto. Respectfully submitted, /s/REITNER & STUART ------------------- REITNER & STUART JFS:wsm