Investment Securities
12 Months Ended
Dec. 31, 2021
Investments, Debt and Equity Securities [Abstract]  
Investment Securities Investment Securities
 
As of December 31, 2021, and 2020, the investment portfolio was comprised primarily of debt securities, with a small portion of the investment portfolio invested in equity securities.

Debt Securities

All of the Company's debt securities were classified as available-for-sale and carried at fair value as of the dates specified in the tables below. The amortized cost and fair values of debt securities at the dates specified are summarized as follows:
 2021
(Dollars in thousands)Amortized
Cost
Unrealized
Gains
Unrealized
Losses
Fair Value
U.S. treasury securities$62,850 $— $684 $62,166 
Residential federal agency MBS(1)
412,902 2,406 9,113 406,195 
Commercial federal agency MBS(1)
99,681 3,783 52 103,412 
Taxable municipal securities272,507 5,607 2,264 275,850 
Tax-exempt municipal securities87,024 5,648 — 92,672 
Corporate bonds 8,559 441 — 9,000 
Subordinated corporate bonds7,000 135 — 7,135 
Total debt securities, at fair value$950,523 $18,020 $12,113 $956,430 
 2020
(Dollars in thousands)Amortized
Cost
Unrealized
Gains
Unrealized
Losses
Fair Value
Residential federal agency MBS(1)
$209,923 $6,339 $287 $215,975 
Commercial federal agency MBS(1)
102,468 7,726 — 110,194 
Taxable municipal securities135,117 9,293 144,407 
Tax-exempt municipal securities88,235 7,216 — 95,451 
Corporate bonds10,448 828 — 11,276 
Subordinated corporate bonds5,000 — — 5,000 
Total debt securities, at fair value$551,191 $31,402 $290 $582,303 
 __________________________________________ 
(1)These categories may include investments issued or guaranteed by government sponsored enterprises such as Fannie Mae ("FNMA"), Freddie Mac ("FHLMC"), Federal Farm Credit Bank ("FFCB"), or one of several Federal Home Loan Banks, as well as, investments guaranteed by Ginnie Mae ("GNMA"), a wholly-owned government entity.

As of the dates reflected in the tables above, the majority of investments in the residential and commercial federal agency mortgage back securities ("MBS") categories were collateralized mortgage obligations ("CMOs") issued by U.S. government agencies. The remaining MBS investments totaled $22.9 million, and $18.7 million at December 31, 2021 and 2020, respectively.

Accrued interest receivable on available-for-sale debt securities, included in the "Accrued Interest Receivable" line item on the Company’s Consolidated Balance Sheets, amounted to $3.2 million and $2.3 million at December 31, 2021 and December 31, 2020, respectively.
The following tables summarize the duration of unrealized losses for debt securities at December 31, 2021 and 2020: 
 2021
 Less than 12 months12 months or longerTotal
(Dollars in thousands)Fair
Value
Unrealized
Losses
Fair
Value
Unrealized
Losses
Fair
Value
Unrealized
Losses
# of Holdings
U.S. treasury securities$62,166 $684 $— $— $62,166 $684 
Residential federal agency MBS272,863 6,992 51,281 2,121 324,144 9,113 44 
Commercial federal agency MBS4,897 52 — — 4,897 52 
Taxable municipal securities117,388 2,023 6,727 241 124,115 2,264 118 
Total temporarily impaired debt securities$457,314 $9,751 $58,008 $2,362 $515,322 $12,113 172 

 2020
 Less than 12 months12 months or longerTotal
(Dollars in thousands)Fair
Value
Unrealized
Losses
Fair
Value
Unrealized
Losses
Fair
Value
Unrealized
Losses
# of Holdings
Residential federal agency MBS$51,396 $284 $2,107 $$53,503 $287 10 
Taxable municipal securities1,997 — — 1,997 
Total temporarily impaired debt securities$53,393 $287 $2,107 $$55,500 $290 14 

The contractual maturity distribution at December 31, 2021 of debt securities was as follows:
(Dollars in thousands)Amortized CostFair Value
Due in one year or less$13,398 $13,478 
Due after one, but within five years189,626 195,778 
Due after five, but within ten years271,354 276,528 
Due after ten years476,145 470,646 
Total debt securities$950,523 $956,430 

Scheduled contractual maturities shown above may not reflect the actual maturities of the investments. The actual MBS/CMO cash flows likely will be faster than presented above due to prepayments and amortization. Similarly, included in the table above are callable securities, comprised of municipal securities and corporate bonds, with a fair value of $181.1 million at December 31, 2021, which can be redeemed by the issuers prior to the maturity presented above. Management considers these factors when evaluating the interest-rate risk in the Company's asset-liability management program.
 
From time to time the Company may pledge debt securities as collateral for deposit account balances of municipal customers, and for borrowing capacity with the FHLB and the FRB. The fair value of debt securities pledged as collateral for these purposes was $949.3 million and $577.3 million at December 31, 2021 and 2020, respectively.
 
Sales of debt securities, for the years ended December 31, 2021, 2020, and 2019 are summarized as follows: 
(Dollars in thousands)202120202019
Amortized cost of debt securities sold(1)
$2,931 $5,680 $11,621 
Gross realized gains on sales128 227 149 
Gross realized losses on sales— — (3)
Total proceeds from sales of debt securities$3,059 $5,907 $11,767 
__________________________________________
(1)     Amortized cost of investments sold is determined on a specific identification basis and includes pending trades based on trade date, if applicable.

Tax-exempt interest earned on the municipal securities portfolio was $3.4 million for the year ended December 31, 2021, $3.5 million for the year ended December 31, 2020, and $3.8 million for the year ended December 31, 2019.
The average balance of tax-exempt investments was $87.8 million and $91.0 million for the years ended December 31, 2021 and December 31, 2020, respectively.

Equity Securities

As of December 31, 2021, the Company held equity securities with a fair value of $1.8 million, compared to $746 thousand at December 31, 2020. Included in the equity portfolio were investments with a fair value of $924 thousand and $476 thousand at December 31, 2021 and December 31, 2020, respectively, held in conjunction with the Company's supplemental executive retirement and deferred compensation plan.

Gains and losses on equity securities at December 31, 2021 and December 31, 2020 are summarized as follows:
(Dollars in thousands)20212020
Net (losses) gains recognized during the period on equity securities $246 $(49)
Less: Net (losses) gains realized on equity securities sold during the period57 (11)
Unrealized gains (losses) recognized during the reporting period on equity securities still held at the end of the period (included in other income)$189 $(38)