EXHIBIT 5 [Letterhead of Shaw, Pittman, Potts & Trowbridge] July 18, 1996 American Management Systems, Incorporated 4050 Legato Road Fairfax, Virginia 22033 Ladies and Gentlemen: We have acted as counsel to American Management Systems, Incorporated (the "Company"), a Delaware corporation, in connection with the registration of 3,800,000 shares of its Common Stock, $0.01 par value per share (the "Common Stock"), pursuant to a Registration Statement on Form S-8 under the Securities Act of 1933, as amended (the "Registration Statement"), and Stock Option Plan F (the "Plan"). Based upon examination and review of (i) the Second Restated Certificate of Incorporation of the Company, (ii) the Bylaws of the Company, as amended, (iii) the resolutions of the Board of Directors of the Company dated April 3, 1996, and (iv) the Plan, we are of the opinion that the Common Stock has been duly authorized for issuance by the Company, and that upon issuance and delivery in accordance with the Plan referred to in the Registration Statement, the Common Stock will be validly issued, fully paid and nonassessable. Our opinions stated in this letter are based on the published compilations of the General Corporation Law of the State of Delaware in effect on the date of this letter. The opinions expressed in this letter are limited to the matters set forth herein, and no other opinions should be inferred beyond the matters expressly stated. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement. Very truly yours, /s/ SHAW, PITTMAN, POTTS & TROWBRIDGE SHAW, PITTMAN, POTTS & TROWBRIDGE