<PAGE>
                                                                    EXHIBIT 10.4

                           MASTER REPURCHASE AGREEMENT


Effective as of January 8, 2004 by and between The North River Insurance Company
("North River") and Fairfax Financial Holdings Limited ("Fairfax").

WHEREAS, North River, in the normal course of its business, may from time to
time agree to pay claims to policyholders that require it to sell or otherwise
liquidate certain securities or other invested assets in order to raise
sufficient cash to make such payments; and

WHEREAS, North River typically pays policyholder claims prior to receiving
reimbursement for such claims from its reinsurers, requiring North River to make
cash payments on claims that can greatly exceed its ultimate net liability for
such claims and creating a timing gap between payments by North River and
recovery from its reinsurers; and

WHEREAS, Fairfax, as the indirect owner of North River, has an interest in
maximizing the return on invested assets of North River; and

WHEREAS, Fairfax seeks to assist North River in managing its cash flow to
eliminate or minimize investment losses resulting from the sale or liquidation
of securities in order to cover short-term cash requirements.

NOW, THEREFORE, for due and valuable consideration, the receipt and adequacy of
which are hereby acknowledged, the parties agree as follows:

1.       TRANSACTIONS
         From time to time, the parties hereto may enter into transactions (each
         a "Transaction") in which North River agrees to transfer to Fairfax
         certain securities ("Securities") against the transfer of an amount in
         United States dollars equal to the fair market value of such Securities
         on the date of transfer, such amount not to exceed U.S. $25,000,000
         singly or, when combined with amounts then outstanding from any other
         Transaction, in the aggregate (the "Purchase Price") by Fairfax to
         North River and Fairfax agrees to transfer to North River such
         Securities on or before one hundred eighty-three (183) days after the
         transfer is made (the "Repurchase Date"), against the transfer of funds
         by North River. From the date of the transfer of the Securities from
         North River to Fairfax until such time that the Securities are returned
         by Fairfax to North River, the Securities will be held by The Bank of
         New York. The transactions pursuant to the Agreement shall be reported
         on accordance with SSAP 45.

2.       REPURCHASE
         North River shall repurchase the Securities from Fairfax on or before
         the Repurchase Date for an amount not to exceed the sum of the Purchase
         Price and the aggregate amount obtained by daily application of the
         stated interest rate of

                                        1
<PAGE>

         each Security to the Purchase Price paid for such Security on a 360 or
         365 day per year basis depending on the interest period of the
         underlying security for the actual number of days during the period
         commencing on the (and including) the Purchase Date and ending on (but
         excluding) the Repurchase Date.

3.       INCOME PAYMENTS
         North River shall be entitled to receive, with respect to any Security
         at any time, an amount equal to any principal thereof and all interest,
         dividends or other distributions thereon ("Income") paid or distributed
         in respect of the Securities that are not otherwise received by North
         River to the full extent it would be so entitled if the Securities had
         not been sold to Fairfax. Fairfax shall, as the parties may agree (or,
         in the absence of any such agreement, as Fairfax shall reasonably
         determine in its discretion), on the date such Income is paid or
         distributed either (i) transfer to or credit to the accounts of North
         River such Income with respect to any Securities or (ii) with respect
         to Income paid in cash, apply the Income payment or payments to reduce
         the amount, if any, to be transferred to Fairfax by North River upon
         termination of the Transaction.

4.       SECURITY INTEREST
         Although the parties intend that the Transaction be a sale and purchase
         and not a loan, in the event the Transaction is deemed to be a loan,
         North River shall be deemed to have pledged to Fairfax as security for
         the performance by North River of its obligations under the
         Transaction, and shall be deemed to have granted to Fairfax a security
         interest in, all of the Securities and all income thereon and other
         proceeds thereof.

5.       PAYMENT AND TRANSFER
         Unless otherwise mutually agreed, all transfers of funds hereunder
         shall be in immediately available funds. All Securities transferred by
         one party hereto to the other party (i) shall be in suitable form for
         transfer or shall be accompanied by duly executed instruments of
         transfer or assignment in blank and such other documentation as the
         party receiving possession may reasonably request, (ii) shall be
         transferred on the book-entry system of a Federal Reserve Bank, or
         (iii) shall be transferred by any other method mutually acceptable to
         North River and Fairfax.

6.       SEGREGATION OF SECURITIES
         To the extent required by applicable law, all Securities in the
         possession of Fairfax shall be segregated from other securities in its
         possession and shall be identified as subject to this Agreement.
         Segregation may be accomplished by appropriate identification on the
         books and records of the holder, including a financial or securities
         intermediary or a clearing corporation.

7.       NOTICES AND OTHER COMMUNICATIONS
         Any and all notices or other communications hereunder shall be given by
         mail or facsimile as follows:


                                       2
<PAGE>


         To Fairfax:                Fairfax Financial Holdings Limited
                                    95 Wellington Street West, Suite 800
                                    Toronto, Ontario, Canada M5J 2N7
                                    Facsimile:  416-367-2201
                                    Attention: Chief Financial Officer

         To North River:            The North River Insurance Company
                                    305 Madison Avenue
                                    Morristown, New Jersey 07960
                                    Facsimile:  973-490-6612
                                    Attention:  Chief Financial Officer

8.       ENTIRE AGREEMENT; SEVERABILITY; AMENDMENT; MODIFICATION; AND
         TERMINATION
         This Agreement shall supersede any existing agreements between the
         parties concerning the subject matter hereof. Each provision and
         agreement herein shall be treated as separate and independent from any
         other provision or agreement herein and shall be enforceable
         notwithstanding the unenforceability of any such other provision or
         agreement. No amendment, assignment, modification or termination of
         this Agreement shall be effective unless such amendment, assignment,
         modification or termination is (i) filed with the New Jersey Department
         of Banking and Insurance ("NJDBI") at least 30 days prior to the
         proposed effective date, (ii) not disapproved by the NJDBI, (iii) made
         in writing, and (iv) signed by the parties hereto.

9.       GOVERNING LAW
         This Agreement shall be governed by the laws of the State of New Jersey
         without giving effect to the conflict of law principles thereof.

10.      COUNTERPARTS
         This Agreement may be executed in two counterparts, each of which shall
         be deemed an original, but all of which together shall constitute one
         and the same instrument.

                                         FAIRFAX FINANCIAL HOLDINGS LIMITED


                                         ---------------------------------------
                                         By:
                                         Title:


                                         THE NORTH RIVER INSURANCE COMPANY


                                       3
<PAGE>


                                         /s/  HOWARD DEBARE
                                         ---------------------------------------
                                         By:  Howard DeBare
                                         Title:  Vice President


                                         /s/  VALERIE J. GASPARIK
                                         ---------------------------------------
                                         By:  Valerie J. Gasparik
                                         Title:  Vice President




                                       4
<PAGE>


                              AMENDMENT NUMBER ONE
                                     TO THE
                           MASTER REPURCHASE AGREEMENT


This Amendment Number One ("Amendment") to the Master Repurchase Agreement
("Agreement") is entered into as of January 8, 2004, by and between The North
River Insurance Company ("North River") and Fairfax Financial Holdings Limited
("Fairfax").

WHEREAS, North River and Fairfax entered into the Agreement effective as of
January 8, 2004;

WHEREAS, defined terms used herein but not otherwise defined shall have the
meanings set forth in the Agreement;

NOW, THEREFORE, in consideration of the foregoing and for good and valuable
consideration, the receipt and adequacy of which is hereby acknowledged, the
parties hereto agree as follows:

I.       Section 1 of the Agreement is hereby replaced in its entirety with the
following:

1.       TRANSACTIONS
From time to time, the parties hereto may enter into transactions (each a
"Transaction") in which North River agrees to transfer to Fairfax certain
securities ("Securities") against the transfer of an amount in United States
dollars equal to the fair market value of such Securities on the date of
transfer, such amount not to exceed U.S. one hundred million dollars
($100,000,000) singly or, when combined with amounts then outstanding from any
other Transaction, in the aggregate (the "Purchase Price") by Fairfax to North
River and Fairfax agrees to transfer to North River such Securities on or before
one hundred eighty-three (183) days after the transfer is made (the "Repurchase
Date"), against the transfer of funds by North River. From the date of the
transfer of the Securities from North River to Fairfax until such time that the
Securities are returned by Fairfax to North River, the Securities will be held
by The Bank of New York. The transactions pursuant to the Agreement shall be
reported on accordance with SSAP 45.

II.      Except as otherwise provided in its Amendment, all of the terms and
         conditions of the Agreement will remain unamended and shall continue to
         be, and shall remain, in full force and effect in accordance with their
         respective terms. In the event of any conflict or inconsistency between
         the Agreement and this Amendment, this Amendment will prevail.

III.     This Amendment shall be binding upon and inure to the benefit of the
         parties hereto and their respective successors and assigns.



                                       5
<PAGE>


IV.      This Amendment may be executed simultaneously in two or more
         counterparts, each of which shall be deemed to be an original and all
         of which shall constitute together but one and the same instrument.

V.       This Amendment shall be governed by the laws of the State of New
         Jersey.

VI.      The transactions pursuant to the Agreement and this Amendment shall be
         reported in accordance with SSAP 45.



IN WITNESS WHEREOF, the parties hereto have caused this Amendment to be executed
and delivered as of the date first set forth above.

                                         FAIRFAX FINANCIAL HOLDINGS LIMITED


                                         ---------------------------------------
                                         By:
                                         Title:


                                         THE NORTH RIVER INSURANCE COMPANY

                                         /s/  HOWARD DEBARE
                                         ---------------------------------------
                                         By:  Howard DeBare
                                         Title:  Vice President


                                         /s/  VALERIE J. GASPARIK
                                         ---------------------------------------
                                         By:  Valerie J. Gasparik
                                         Title:  Vice President



                                       6