securities with a fair market value of $9.8 million. Federal Home Loan Bank advances remained constant at $141.0 million for the nine months ended September 30, 2021 and decreased by $15.0 million for the nine months ended September 30, 2020. Securities sold under agreements to repurchase remained constant at $10.0 million for the nine months ended September 30, 2021 and 2020.
Our investments in mortgage-backed securities have been issued by Freddie Mac or Fannie Mae, which are U.S. government-sponsored enterprises, or Ginnie Mae, which is a U.S. government agency. These entities guarantee the payment of principal and interest on our mortgage-backed securities. As of September 30, 2021 and December 31, 2020, we owned $621.4 million and $251.2 million, respectively, of mortgage-backed securities issued by Freddie Mac, Fannie Mae and Ginnie Mae.
Critical Accounting Policies
There are no material changes to the critical accounting policies disclosed in Territorial Bancorp Inc.’s Annual Report on Form 10-K for the year ended December 31, 2020.
Comparison of Financial Condition at September 30, 2021 and December 31, 2020
Assets. Our total assets increased by $6.3 million, or 0.3%, to $2.1 billion at September 30, 2021. The increase in assets was primarily due to a $370.2 million increase in total investment securities, which was partially offset by a $262.2 million decrease in cash and a $104.7 million decrease in total loans.
Cash and Cash Equivalents. Cash and cash equivalents were $101.4 million at September 30, 2021, a decrease of $262.2 million since December 31, 2020. The decrease in cash and cash equivalents was primarily caused by a $370.2 million increase in total investment securities, which was partially offset by a $104.7 million decrease in total loans.
Loans. Total loans, including $488,000 of loans held for sale, were $1.3 billion at September 30, 2021, or 61.6% of total assets. During the nine months ended September 30, 2021, the loan portfolio, including loans held for sale, decreased by $104.7 million, or 7.4%. The decrease in the loan portfolio primarily occurred as principal repayments and loan sales exceeded the origination of new loans.
Securities. At September 30, 2021, our securities portfolio totaled $621.4 million, or 29.4% of total assets. During the nine months ended September 30, 2021, the securities portfolio increased by $370.2 million. The increase in the securities balance occurred as purchases exceeded the principal repayments and sales of securities. Mortgage-backed securities were purchased during the year to offset the decrease in interest income that occurred because of the decrease in our loan portfolio.
At September 30, 2021, none of the underlying collateral consisted of subprime or Alt-A (traditionally defined as nonconforming loans having less than full documentation) loans.
Deposits. Deposits were $1.7 billion at September 30, 2021, an increase of $5.2 million, or 0.3%, since December 31, 2020. The growth in deposits was primarily due to increases of $66.8 million in savings accounts and $25.5 million in checking accounts. These increases were partially offset by a $86.0 million decrease in certificates of deposit during the nine months ended September 30, 2021.
Borrowings. Our borrowings consist of advances from the Federal Home Loan Bank and funds borrowed under securities sold under agreements to repurchase. During the nine months ending September 30, 2021 total borrowings remained constant at $151.0 million.
Stockholders’ Equity. Total stockholders’ equity was $251.7 million at September 30, 2021, an increase of $3.0 million, or 1.2%, from December 31, 2020. The increase in stockholders’ equity occurred primarily due to net income of $13.2 million, which was partially offset by the declaration of $6.3 million of dividends and the repurchase of $4.9 million of common stock.