currency forward contracts. Net realized gains were $3,741 for the nine months ended June 30, 2024 which was primarily related to the exits of certain investments and foreign currency forward contracts. Net realized losses were $476 and $2,877 for the three and nine months ended June 30, 2023 and primarily related to the exits of certain investments and foreign currency forward contracts.
Financial Condition, Liquidity and Capital Resources
We expect to generate cash from (1) the cash proceeds from our continuous public offering, (2) cash flows from operations, including earnings on investments, as well as interest earned from the temporary investment of cash in cash-equivalents, U.S. high-quality debt investments that mature in one year or less, (3) borrowings from banks, including secured borrowings, unsecured debt offerings, and any other financing arrangements we may enter into in the future and (4) any future offerings of equity or debt securities.
Our primary use of cash is for (1) investments in portfolio companies and other investments, (2) the cost of operations (including our expenses, the Management Fee and the Incentive Fee), (3) debt service, repayment and other financing costs of our borrowings, (4) funding repurchases under our share repurchase program, and (5) cash distributions to the shareholders.
For the nine months ended June 30, 2024, we experienced a net increase in cash and cash equivalents of $274.0 million. During that period, $2,078.3 million of cash was used in operating activities, primarily consisting of cash used to fund new investments, partially offset by proceeds from the sales and repayments of investments. During the same period, cash provided by financing activities was $2,353.4 million, due primarily from $1,343.7 million of proceeds from the issuance of common shares, $815.0 million of net borrowings under the credit facilities and $348.2 million of proceeds from the issuance of unsecured notes, partially offset by $113.9 million of distributions paid to shareholders, $23.9 million of shares repurchases paid and $15.6 million of deferred financing and offering costs paid.
For the nine months ended June 30, 2023, we experienced a net increase in cash and cash equivalents of $21.8 million. During that period, $821.5 million of cash was used in operating activities, primarily consisting of cash used to fund new investments, partially offset by proceeds from the sales and repayments of investments. During the same period, cash provided by financing activities was $844.8 million, due primarily from $637.3 million of proceeds from the issuance of common shares and $250.0 million of net borrowings under the credit facilities, partially offset by $34.5 million of distributions paid to shareholders and $7.9 million of deferred costs paid.
As of June 30, 2024, we had $425.1 million of cash and cash equivalents (including restricted cash of $30.3 million), portfolio investments (at fair value) of $4,189.3 million, $32.5 million of interest receivable, $1,425.0 million of undrawn capacity on our credit facilities (subject to borrowing base and other limitations), $108.8 million of net payables from unsettled transactions, $1,260.0 million of borrowings outstanding under our credit facilities and $346.1 million of unsecured notes payable (net of unamortized financing costs, unaccreted discount and interest rate swap fair value adjustment).
As of September 30, 2023, we had $151.1 million of cash and cash equivalents (including restricted cash of $5.6 million), portfolio investments (at fair value) of $1,927.2 million, $12.6 million of interest receivable, $0.9 million of due from affiliates, $1,190.0 million of undrawn capacity on our credit facilities (subject to borrowing base and other limitations), $94.3 million of net payables from unsettled transactions and $445.0 million of borrowings outstanding under our credit facilities.
We are a party to financial instruments with off-balance sheet risk in the normal course of business to meet the financial needs of our portfolio companies. As of June 30, 2024 and September 30, 2023, off-balance sheet arrangements consisted of $569,726 and $224,611, respectively, of unfunded commitments to provide debt financing to certain of our portfolio companies. As of June 30, 2024, of the $569,726 of unfunded commitments,
123