EXHIBIT 5.1 [LATHAM & WATKINS LLP LETTERHEAD] January 16, 2004 MidAmerican Energy Company 666 Grand Avenue Des Moines, Iowa 50303 Re: MidAmerican Energy Company; Registration Statement on Form S-3 (Registration No. 333-110398) ------------------------------------------------------------ Ladies and Gentlemen: In connection with the Registration Statement on Form S-3 filed by MidAmerican Energy Company, an Iowa corporation (the "Company"), with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Securities Act"), on November 10, 2003, as amended by Amendment No. 1 thereto filed with the Commission on December 23, 2003 and Amendment No. 2 thereto filed with the Commission on January 16, 2004 (File No. 333-110398) (the "Registration Statement"), you have requested our opinion with respect to the matters set forth below. You have provided us with a prospectus dated the date hereof (the "Prospectus") which is a part of the Registration Statement. The Prospectus provides that it will be supplemented in the future by one or more supplements to the Prospectus (each, a "Prospectus Supplement"). The Prospectus, as supplemented by various Prospectus Supplements, will provide for the registration by the Company of up to $880,000,000 aggregate offering price of (i) one or more series of senior or subordinated debt securities of the Company (the "Debt Securities"), and (ii) one or more series of preferred stock of the Company, no par value per share (the "Preferred Stock"). The Debt Securities may be issued pursuant to one or more indentures in the form attached as Exhibit 4.1 or Exhibit 4.2 to the Registration Statement (each, an "Indenture"), in each case between the Company and a trustee (each, a "Trustee"). In our capacity as your special counsel in connection with the Registration Statement, we are generally familiar with the proceedings taken and proposed to be taken by the Company in connection with the authorization and issuance of the Debt Securities. For purposes of this opinion, we have assumed that proceedings to be taken in the future will be timely and properly completed in the manner proposed. In addition, we have examined such matters of fact and questions of law as we have considered appropriate for purposes of this letter. As to facts material to the opinions, statements and assumptions expressed herein, we have, with your consent, relied upon oral or written statements and representations of officers and other representatives of the Company and others. In addition, we have obtained and relied upon such certificates and assurances from public officials as we have deemed necessary. We are opining herein only as to the effect on the Debt Securities of the internal laws of the State of New York. We express no opinion with respect to the applicability thereto, or the effect thereon, of the laws of any other jurisdiction or as to any matters of municipal law or the laws of any local agencies within any state. With respect to the opinions expressed in clause (1) of the following paragraph, to the extent they involve matters arising under the laws of the State of Iowa, we have with your consent relied exclusively on the opinion of Paul J. Leighton, Esq., Assistant General Counsel of the Company, a copy of which is attached hereto as Exhibit A, subject to all of the assumptions, limitations and qualifications set forth therein. Subject to the foregoing and the other qualifications set forth herein, it is our opinion that, as of the date hereof, (1) (a) the Company is a corporation under the Iowa Business Corporation Act, is validly existing and is in good standing under the laws of the State of Iowa and has the corporate power and authority to issue and sell the Debt Securities and to execute, deliver and perform its obligations under the applicable Indenture and (b) the Debt Securities have been duly authorized by all necessary corporate action by the Company, subject to further action of the Board of Directors of the Company, or a committee authorized to act on behalf of the Board of Directors of the Company, authorizing the price or prices and other terms of the Debt Securities at the time of any issuance, and (2) when (a) the applicable Indenture has been duly authorized by all necessary corporate action by the Company and the Trustee, has been duly executed and delivered by the Company and the Trustee and constitutes a legal, valid and binding obligation of the Company and the Trustee enforceable against the Company and the Trustee in accordance with its terms, (b) the Debt Securities have been duly established in accordance with the applicable Indenture and applicable law, and upon adoption by the Board of Directors of the Company of a resolution in form and content as required by applicable law and upon due authentication, execution and delivery by the Trustee of the Debt Securities on behalf of the Company against payment therefor in the manner contemplated by the Registration Statement, the Prospectus and the related Prospectus Supplement(s) and by such resolution, and (c) the Registration Statement and any required post-effective amendment thereto and any and all Prospectus Supplement(s) required by applicable law have all become effective under the Securities Act, and assuming that (i) the terms of the Debt Securities as executed and delivered are as described in the Registration Statement, the Prospectus and the related Prospectus Supplement(s), (ii) the Debt Securities as executed and delivered do not violate any law applicable to the Company or result in a default under or breach of any agreement or instrument binding upon the Company, (iii) the Debt Securities as executed and delivered comply with all requirements and restrictions, if any, applicable to the Company, whether imposed by any court or governmental or regulatory body having jurisdiction over the Company or otherwise, and (iv) the Debt Securities are then issued and sold as contemplated in the Registration Statement, the Prospectus and the related Prospectus Supplement(s), the Debt Securities will constitute the legally valid and binding obligations of the Company, enforceable against the Company in accordance with the terms of the Debt Securities. The opinions set forth in the immediately preceding paragraph are subject to the following exceptions, limitations and qualifications: (i) the effect of bankruptcy, insolvency, reorganization, moratorium or other similar laws now or hereafter in effect relating to or affecting the rights and remedies of creditors; (ii) the effect of general principles of equity, whether enforcement is considered in a proceeding in equity or at law (including the possible unavailability of specific performance or injunctive relief); (iii) the unenforceability under certain circumstances under law or court decisions of provisions providing for the indemnification of or contribution to a party with respect to a liability where such indemnification or contribution is contrary to public policy; (iv) we express no opinion concerning the enforceability of any waiver of rights or defenses with respect to stay, extension or usury laws; and (v) we express no opinion with respect to whether acceleration of the Debt Securities may affect the collectibility of any portion of the stated principal amount thereof which might be determined to constitute unearned interest thereon. We have not been requested to express, and with your knowledge and consent do not render, any opinion as to the applicability to the obligations of the Company under the Debt Securities of Sections 547 and 548 of the United States Bankruptcy Code or applicable state law (including, without limitation, Article 10 of the New York Debtor and Creditor Law) relating to preferences and fraudulent transfers and obligations. We consent to your filing this opinion as an exhibit to the Registration Statement and to the reference to our firm under the caption "Legal Matters" in the Prospectus included therein. This opinion is rendered only to you and is solely for your benefit in connection with the transactions covered hereby. This opinion may not be relied upon by you for any other purpose, or furnished to, quoted to, or relied upon by any other person, firm or corporation for any purpose, without our prior written consent. Very truly yours, /s/ Latham & Watkins LLP EXHIBIT A OPINION OF PAUL J. LEIGHTON, ESQ [LETTERHEAD OF MIDAMERICAN ENERGY COMPANY] January 16, 2004 Latham & Watkins LLP 885 Third Avenue New York, New York 10022 Ladies and Gentlemen: I am the Assistant General Counsel of MidAmerican Energy Company, an Iowa corporation (the "Company"). I have served in such capacity in connection with the Registration Statement (as defined below) on Form S-3 filed by the Company with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Securities Act"), on November 10, 2003, as amended by Amendment No. 1 thereto filed with the Commission on December 23, 2003 and Amendment No. 2 thereto filed with the Commission on January 16, 2004 (File No. 333-110398) (the "Registration Statement"). The Company has provided me with a prospectus dated the date hereof (the "Prospectus") which is part of the Registration Statement. The Prospectus provides that it will be supplemented in the future by one or more supplements to the Prospectus (each, a "Prospectus Supplement"). The Prospectus, as supplemented by various Prospectus Supplements, will provide for the registration by the Company of up to $880,000,000 aggregate offering price of (i) one or more series of senior or subordinated debt securities (the "Debt Securities"), and (ii) one or more series of preferred stock, no par value per share. The Debt Securities may be issued pursuant to one or more indentures in the form attached as Exhibit 4.1 or Exhibit 4.2 to the Registration Statement (each, an "Indenture"), in each case between the Company and a trustee. In my capacity as the Assistant General Counsel of the Company, I am generally familiar with the proceedings taken and proposed to be taken by the Company in connection with the authorization and issuance of the Debt Securities. I have made such legal and factual examinations and inquiries, including an examination of originals and copies certified or otherwise identified to my satisfaction, of all such documents, corporate records and instruments of the Company as I have deemed necessary or appropriate for purposes of this opinion. In my examination, I have assumed the genuineness of all signatures, the authenticity of all documents submitted to me as originals, and the conformity to authentic original documents of all documents submitted to me as copies. As to facts material to the opinions, statements and assumptions expressed herein, I have, with your consent, relied upon oral or written statements and representations of officers and other representatives of the Company and others. In addition, I have obtained and relied upon such certificates and assurances from public officials as I have deemed necessary. I am opining herein as to the effect on the Debt Securities of the internal laws of the State of Iowa, and I express no opinion with respect to the applicability thereto, or the effect thereon, of the laws of any other jurisdiction or as to any matters of municipal law or the laws of any local agencies within any state. Based on and subject to the foregoing, it is my opinion that, as of the date hereof, (a) the Company is a corporation under the Iowa Business Corporation Act, is validly existing and is in good standing under the laws of the State of Iowa and has the corporate power and authority to issue and sell the Debt Securities and to execute, deliver and perform its obligations under the applicable Indenture and (b) the Debt Securities have been duly authorized by all necessary corporate action by the Company, subject to further action of the Board of Directors of the Company, or a committee authorized to act on behalf of the Board of Directors of the Company, authorizing the price or prices and other terms of the Debt Securities at the time of any issuance. I consent to this opinion being attached as an exhibit to the opinion of Latham & Watkins LLP of even date herewith filed as an exhibit to the Registration Statement. This letter is rendered only to you and is solely for your benefit in connection with the transactions covered hereby. This opinion may not be relied upon by you for any other purpose, or furnished to, quoted to, or relied upon by any other person, firm or corporation for any purpose, without my prior written consent. Sincerely, /s/ Paul J. Leighton Paul J. Leighton, Esq. Assistant General Counsel