1 EXHIBIT 5.1 [ON WILSON SONSINI GOODRICH & ROSATI LETTERHEAD] June 27, 1996 Anergen, Inc. 301 Penobscot Drive Redwood City, CA 94063 RE: REGISTRATION STATEMENT ON FORM S-1 Ladies and Gentlemen: We have examined the Registration Statement on Form S-1 to be filed by you with the Securities and Exchange Commission on June 28, 1996 (as such may thereafter be amended or supplemented, the "Registration Statement"), in connection with the registration under the Securities Act of 1933, as amended, of up to 4,600,000 shares of your Common Stock, no par value (the "Shares"). We understand that the Shares are to be sold to the underwriters of the offering for resale to the public as described in the Registration Statement. As your legal counsel, we have examined the proceedings taken, and are familiar with the proceedings proposed to be taken, by you in connection with the sale and issuance of the Shares. It is our opinion that, upon completion of the proceedings being taken or contemplated by us, as your counsel, to be taken prior to the issuance of the Shares, including the proceedings being taken in order to permit such transaction to be carried out in accordance with applicable state securities laws, the Shares, when issued and sold in the manner described in the Registration Statement and in accordance with the resolutions adopted by the Board of Directors of Anergen, Inc., will be legally and validly issued, fully paid and nonassessable. We consent to the use of this opinion as an exhibit to the Registration Statement and further consent to the use of our name wherever appearing in the Registration Statement, including the Prospectus constituting a part thereof, and any amendments thereto. Very truly yours, WILSON, SONSINI, GOODRICH & ROSATI Professional Corporation /s/ WILSON SONSINI GOODRICH & ROSATI