Exhibit 5.1 [LETTERHEAD OF BALLARD SPAHR ANDREWS & INGERSOLL] December 23, 1997 Kilroy Realty Corporation 2250 East Imperial Highway El Segundo, California 90245 Re: Kilroy Realty Corporation, a Maryland corporation, (the "Company") - Registration Statement on Form S-8 (the "Registration Statement") pertaining to One Million Five Hundred Thousand (1,500,000) shares (the "Plan Shares") of common stock, par value one cent ($.01) per share ("Common Stock"), to be issued pursuant to the 1997 Stock Option and Incentive Plan for Key Employees of the Company, Kilroy Realty, L.P. and Kilroy Services, Inc. (the "Plan") ---------------------------------------------------------------------- Ladies and Gentlemen: In connection with the registration of the Plan Shares under the Securities Act of 1933, as amended (the "Act") by the Company on Form S-8 to be filed with the Securities and Exchange Commission on or about December 23, 1997, (the "Registration Statement"), you have requested our opinion with respect to the matters set forth below. We have acted as special Maryland corporate counsel for the Company in connection with the matters described herein. In our capacity as special Maryland corporate counsel to the Company, we have reviewed and are familiar with proceedings taken and proposed to be taken by the Company in connection with the authorization, issuance and sale of the Plan Shares, and for purposes of this opinion have assumed such proceedings will be timely completed in the manner presently proposed. In addition, we have relied upon certificates and advice from the officers of the Company upon which BALLARD SPAHR ANDREWS & INGERSOLL Kilroy Realty Corporation December 23, 1997 Page 2 we believe we are justified in relying and on various certificates from, and documents recorded with, the State Department of Assessments and Taxation of Maryland (the "SDAT"), including the charter of the Company (the "Charter"), consisting of Articles of Incorporation filed with the SDAT on September 13, 1996 and Articles of Amendment and Restatement filed with the SDAT on January 21, 1997. We have also examined the Amended and Restated Bylaws of the Company, adopted as of January 26, 1997, (the "Bylaws"), resolutions of the Board of Directors of the Company adopted on December 8, 1996 and January 27, 1997 and in full force and effect on the date hereof, the Plan, and such other laws, records, documents, certificates, opinions and instruments as we have deemed necessary to render this opinion. 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 certified, photostatic or conformed copies. In addition, we have assumed that each person executing any instrument, document or certificate referred to herein on behalf of any party is duly authorized to do so. We have also assumed that none of the Plan Shares have been or will be issued or transferred in violation of the restrictions on ownership and transfer of stock contained in the Charter of the Company under the caption "Restrictions on Ownership and Transfer to Preserve Tax Benefits". Based on the foregoing, and subject to the assumptions and qualifications set forth herein, it is our opinion that, as of the date of this letter: (i) the Plan Shares have been duly reserved and duly authorized for issuance by the Company as direct stock awards or upon the exercise of options granted under the Plan, and when such Plan Shares are issued and delivered by the Company as direct stock awards or upon the exercise of options granted under the Plan and the consideration for such Plan Shares has been received in full by the Company, all in accordance with the Plan and any such options, such Plan Shares will be validly issued, fully paid and non-assessable; and (ii) of the Plan Shares, 100,000 shares have been issued to Richard E. Moran, Jr. (the "Moran Shares"), and the Moran Shares are validly issued, fully paid and non-assessable. We consent to your filing this opinion as an exhibit to the Registration Statement, and further consent to the filing of this opinion as an exhibit to the applications to securities commissioners for the various states of the United States for registration of the Shares. We also consent to the identification of our firm as Maryland counsel to the Company in the section of BALLARD SPAHR ANDREWS & INGERSOLL Kilroy Realty Corporation December 23, 1997 Page 3 the Prospectus (which is part of the Registration Statement) entitled "Legal Matters." The opinions expressed herein are limited to the laws of the State of Maryland and we express no opinion concerning any laws other than the laws of the State of Maryland. Furthermore, the opinions presented in this letter are limited to the matters specifically set forth herein and no other opinion shall be inferred beyond the matters expressly stated. Very truly yours, /s/ Ballard Spahr Andrews & Ingersoll