EXHIBIT 5.1 [LETTERHEAD OF BALLARD SPAHR ANDREWS & INGERSOLL, LLP] May 17, 2002 St. Mary Land & Exploration Company 1776 Lincoln Street, Suite 1100 Denver, Colorado 80203 Re: Registration Statement on Form S-8 for Shares of Common Stock ------------------------------------------------------------- Issuable Under Stock Option Plans --------------------------------- Gentlemen: We have acted as counsel to St. Mary Land & Exploration Company, a Delaware corporation ("St. Mary"), in connection with the filing of a Registration Statement on Form S-8 (the "Registration Statement") to register under the Securities Act of 1933, as amended, an additional 1,000,000 shares of St. Mary common stock, par value $.01 per share (the "Shares"), issuable from time to time upon the exercise of options ("Options") granted under the St. Mary Land & Exploration Company Stock Option Plan, as amended, and the St. Mary Land & Exploration Company Incentive Stock Option Plan, as amended (collectively, the "Plans"). In that connection, we have examined, and relied upon the accuracy of factual matters contained therein, the Plans and originals and copies, certified or otherwise identified to our satisfaction, of such other agreements, documents, corporate records and instruments as we have deemed necessary for the purposes of the opinion expressed below. In giving this opinion, we are assuming the authenticity of all instruments presented to us as originals, the conformity with the originals of all instruments presented to us as copies and the genuineness of all signatures. Based upon the foregoing, we are of the opinion that the Shares, when issued upon exercise of the Options granted under the Plans and upon payment of the option exercise price in accordance with the terms of the Plans, will be legally issued, fully paid and nonassessable. This opinion is limited to the matters expressly stated herein. No implied opinion may be inferred to extend this opinion beyond the matters expressly stated herein. We do not undertake to advise you of any changes in the opinion expressed herein resulting from changes in law, changes in facts or any other matters that might occur or be brought to our attention after the date hereof. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement. Very truly yours, /S/ BALLARD SPAHR ANDREWS & INGERSOLL, LLP