Exhibit 5.1 Cox Smith Matthews Incorporated Attorneys Counselors Direct Number Email Address 210-554-5255 srjacobs@coxsmith.com August 12, 2005 Abraxas Petroleum Corporation 500 North Loop 1604 East, Suite 100 San Antonio, Texas 78232 Re: Registration Statement on Form S-3 for the Registration of 5,096,479 Shares of Abraxas Petroleum Corporation Common Stock Ladies and Gentlemen: We have acted as counsel to Abraxas Petroleum Corporation, a Nevada corporation (the "Company"), in connection with the preparation for filing with the Securities and Exchange Commission of a registration statement on Form S-3 (the "Registration Statement") under the Securities Act of 1933, as amended (the "Securities Act"). The Registration Statement relates to the registration for resale of an aggregate of 5,096,479 shares (the "Shares") of common stock, par value $.01 per share ("Common Stock"), of the Company. 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 facsimile, electronic, certified or photostatic copies, and the authenticity of the originals of such copies. In making our examination of documents executed or to be executed, we have assumed that the parties thereto had the power, corporate or otherwise, to enter into and perform all obligations thereunder and have also assumed the due authorization by all requisite action, corporate or otherwise, by such parties, and the execution and delivery by such parties of such documents. As to any facts material to the opinions expressed herein that we did not independently establish or verify, we have relied upon statements and representations of officers and other representatives of the Company and others and of public officials. We have examined and are familiar with originals or copies, the authenticity of which have been established to our satisfaction, of all such documents, corporate records, certificates of officers of the Company and public officials, and other instruments as we have deemed necessary to express the opinions hereinafter set forth. In expressing our opinions herein, we express no opinion as to compliance with federal and state securities laws. Based upon the foregoing and subject to the limitations, qualifications, exceptions and assumptions set forth herein, we are of the opinion that the Shares have been duly authorized and legally issued and constitute fully paid and nonassessable shares of Common Stock of the Company. ________________________________________________________________________________ 112 EAST PECAN STREET 111 CONGRESS SUITE 1800 SUITE 2800 SAN ANTONIO, TEXAS 78205 AUSTIN, TEXAS 78701 TEL: 210.554.5500 TEL: 512.703.6300 FAX: 210.226.8395 FAX: 512.703.6399 We hereby consent to the filing of this opinion as Exhibit 5.1 to the Registration Statement. In giving this consent, we do not admit that we come within the category of persons whose consent is required under Section 7 of the Securities Act, the general rules and regulations of the Commission promulgated thereunder or any similar provision of any state securities laws or regulations. Very truly yours, COX SMITH MATTHEWS INCORPORATED By: /s/ Steven R. Jacobs --------------------------------------- For the Firm