EXHIBIT 5 --------- OPINION RE LEGALITY 10 GRAY CARY WARE FREIDENRICH A PROFESSIONAL CORPORATION Attorneys at Law 400 Hamilton Avenue Palo Alto, CA 94301-1825 Tel (415) 328-6561 Fax (415) 327-3699 Our File No. July 26, 1995 1050224-901802 Securities and Exchange Commission 450 Fifth Street, N.W. Washington, D.C. 20549 Re: EMCON Registration Statement on Form S-8 Registering Shares Issuable Under the Employee Stock Purchase Plan Ladies and Gentlemen: As legal counsel for EMCON, a California corporation (the "Company"), we are rendering this opinion in connection with the registration under the Securities Act of 1933, as amended, of up to 350,000 shares of the Common Stock of the Company which may be issued pursuant to the exercise of purchase rights granted under the EMCON Employee Stock Purchase Plan (the "Plan"). We have examined all instruments, documents and records which we deemed relevant and necessary for the basis of our opinion hereinafter expressed. In such examination, we have assumed the genuineness of all signatures and the authenticity of all documents submitted to us as originals and the conformity to the originals of all documents submitted to us as copies. We are admitted to practice only in the State of California and we express no opinion concerning any law other than the law of the State of California and the federal law of the United States. 11 Securities and Exchange Commission Page 2 Based on such examination, we are of the opinion that the 350,000 shares of Common Stock which may be issued upon exercise of purchase rights granted under the Plan are duly authorized shares of the Company's Common Stock, and, when issued against payment of the purchase price therefor in accordance with the provisions of the Plan, will be validly issued, fully paid and non-assessable. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement referred to above and the use of our name wherever it appears in said Registration Statement. Respectfully submitted, GRAY CARY WARE & FREIDENRICH A Professional Corporation 12