Exhibit 5.1 [BROBECK, PHLEGER & HARRISON LLP LETTERHEAD] January 23, 1998 Triangle Pharmaceuticals, Inc. 4 University Place 4611 University Drive Durham, North Carolina 27707 Re: 2,789,500 Shares of Common Stock of Triangle Pharmaceuticals, Inc. ------------------------------------------------------------------ Ladies and Gentlemen: We have acted as counsel to Triangle Pharmaceuticals, Inc., a Delaware corporation (the "Company"), in connection with the registration of 2,789,500 shares of Common Stock (the "Common Stock"), as described in the Company's Registration Statement on Form S-3 (the "Registration Statement"), to be filed promptly with the Securities and Exchange Commission under the Securities Act of 1933, as amended. We are familiar with the corporate proceedings taken by the Company in connection with the issuance and sale of the Common Stock. It is our opinion that the Common Stock is validly issued, fully paid and nonassessable. We consent to the filing of this opinion as an exhibit to the Registration Statement and to the reference to this firm under the caption "Legal Matters" in the Prospectus which is part of the Registration Statement. Subject to the foregoing sentence, this opinion is given as of the date hereof solely for your benefit and may not be relied upon, circulated, quoted or otherwise referred to for any purpose without our prior written consent. Very truly yours, /s/ BROBECK, PHLEGER & HARRISON LLP BROBECK, PHLEGER & HARRISON LLP