[LETTERHEAD OF TOBIN & TOBIN] EXHIBIT 5 March 17, 1998 The Board of Directors Headlands Mortgage Company 1100 Larkspur Landing Circle, Suite 101 Larkspur, CA 94939 Re: Registration Statement on Form S-8 relative to the 1997 Executive and Non-Employee Director Stock Option Plan ----------------------------------------------------- Ladies and Gentlemen: We have acted as your counsel in connection with the registration under the Securities Act of 1933, as amended (the "Securities Act"), of an aggregate of up to 1,970,000 shares (the "Shares") of common stock (the "Common Stock") of Headlands Mortgage Company, a California corporation (the "Company"), issuable pursuant to the Company's 1997 Executive and Non-Employee Director Stock Option Plan (the "Plan"). This opinion is delivered in accordance with the requirements of Items 601(b)(5) and (23) of Regulation S-K under the Securities Act. In connection with this opinion, we have examined and are familiar with originals or copies, certified or otherwise identified to our satisfaction, of (i) the Registration Statement on Form S-8, relating to the Shares, filed with the Securities and Exchange Commission (the "Commission") under the Securities Act (together with all exhibits thereto, the "Registration Statement"), (ii) the Prospectus of the Plan to be given to participants pursuant to the requirements of Part I of the Registration Statement, (iii) the Articles of Incorporation of the Company, as amended and presently in effect, (iv) the Bylaws of the Company in effect as of the date hereof, (v) resolutions of the Board of Directors of the Company relating to the issuance of the Shares and the filing and effectiveness of the Registration Statement, and (vi) a specimen of the certificates representing the Shares. We have also examined such other documents, certificates and records as we have deemed necessary or appropriate as a basis for the opinion set forth below. 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, conformed or photostatic copies, and the authenticity of the originals of such copies. As to any facts material to this opinion which we did not independently establish or verify, we have relied upon oral or written statements and representations of officers and other representatives of the Company and others. Members of our firm are admitted to the practice of law in the State of California and we do not express any opinion as to the laws of any other jurisdiction. Based upon and subject to the foregoing, we are of the opinion that the Shares to be issued by the Company pursuant to the Plan, as described in the Registration Statement, have been duly and validly authorized for issuance, and, upon issuance and delivery of the Shares in accordance with the terms of the Plan, the Shares will be validly issued, fully paid and non-assessable. We hereby consent to the filing of this opinion with the Commission as Exhibit 5 to Form S-8 and its incorporation by reference as an exhibit to the Registration Statement. In giving such consent, we do not thereby admit that we are in the category of persons whose consent is required under Section 7 of the Securities Act or under the rules and regulations of the Commission promulgated thereunder. Very truly yours, /s/ Tobin & Tobin