EX-5.1 6 a2124395zex-5_1.htm EX-5.1
QuickLinks -- Click here to rapidly navigate through this document


Exhibit 5.1

December 9, 2003

RLI Corp.
9025 N. Lindbergh Drive
Peoria, Illinois 61615

Re:    RLI Corp.—5.95% Senior Notes due 2014

Ladies and Gentlemen:

        We have acted as counsel to RLI Corp., an Illinois corporation (the "Company"), in connection with the issuance and sale by the Company of an aggregate of $100,000,000 principal amount of the Company's 5.95% Senior Notes due 2014 (the "Securities") pursuant to the Indenture, dated as of December 9, 2003, as supplemented by an Officers' Certificate, dated as of December 9, 2003, under Section 2.02(b) of the Indenture fixing the terms of the Securities (such Indenture, as so supplemented, the "Indenture"), between the Company and J.P. Morgan Trust Company, National Association, as trustee (the "Trustee").

        In connection therewith, we have examined (a) the Registration Statement on Form S-3 (File No. 333-109568) (the "Registration Statement"), filed by the Company and the other related registrant with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Securities Act"), (b) the prospectus of the Company dated December 8, 2003, as supplemented by the prospectus supplement, dated December 9, 2003, relating to the Securities, as filed with the Commission on December 9, 2003, pursuant to Rule 424(b) under the Securities Act (the "Prospectus"), and (c) the form of the Indenture. In addition, we have examined the originals (or copies certified or otherwise identified to our satisfaction) of such other agreements, instruments, certificates, documents and records and have reviewed such questions of law and made such inquiries as we have deemed necessary or appropriate for the purposes of the opinions rendered herein.

        In such examination, we have assumed, without inquiry, the legal capacity of all natural persons, the genuineness of all signatures on all documents examined by us, the authenticity of all documents submitted to us as originals, the conformity to the original documents of all such documents submitted to us as copies and the authenticity of the originals of such latter documents. We have also assumed that the books and records of the Company are maintained in accordance with proper corporate procedures. As to any facts material to our opinion, we have, when relevant facts were not independently established, relied upon the aforesaid agreements, instruments, certificates, documents and records and upon statements and certificates of officers and representatives of the Company and public officials.

        Based upon the foregoing, and subject to the limitations, qualifications and assumptions stated herein, we are of the opinion that the Securities have been duly authorized and (assuming their due authentication by the Trustee), when they have been duly executed, issued and delivered in accordance with the terms of the Indenture, will constitute valid and legally binding obligations of the Company entitled to the benefits provided by the Indenture.

        The opinions rendered herein are limited to the laws of the State of New York, the Illinois Business Corporation Act and the Federal laws of the United States.

        We consent to the filing of this opinion as an exhibit to the Company's Current Report on Form 8-K dated December 10, 2003, which is incorporated by reference into the Registration Statement and the Prospectus and to the use of our name under the caption "Legal Matters" contained in the Prospectus. In giving our consent, we do not thereby concede that we come within the category of persons whose consent is required by the Securities Act or the rules and regulations promulgated thereunder.

                        Very truly yours,
                        /s/ Katten Muchin Zavis Rosenman
                        Katten Muchin Zavis Rosenman




QuickLinks