The provision for loan losses increased by $1.5 million, from a credit to the provision of $1.1 million for the quarter ended June 30, 2021 to an expense of $346,000 for the current quarter. The provision for loan losses increased by $1.8 million, from a credit to the provision of $1.2 million for the six months ended June 30, 2021 to an expense of $567,000 for the six months ended June 30, 2022. The credit to the provision for the three and six months ended June 30, 2021 was primarily attributable to a decline in loan balances, exclusive of PPP loans, a reduction in specific allocations to the allowance for loan losses and a general improvement in the economic conditions as our customers showed signs of recovering from the pandemic. An increase in indirect loan balances in 2022 was the primary factor leading to the increase in the provision.
Recoveries outpaced charge-offs, resulting in net recoveries of $123,000 and $13,000 for the quarters ended June 30, 2022 and 2021, respectively. A net recovery for the six months ended June 30, 2022 totaled $43,000 compared to a net charge-off of $290,000 for the comparable period in 2021. The year-to-date net recoveries in 2022 were primarily due to a $143,000 recovery of a residential mortgage loan, pricing gains on the sales of repossessed vehicles as used car prices have risen significantly, and an improvement in the overall economic environment. There was a general overall improvement in loan quality during the first six months of 2022 as overdue account balances fell $75,000, we had net recoveries of $43,000, and non-performing assets decreased $2.1 million.
Non-interest income totaled $1.5 million for the three months ended June 30, 2022, a decrease of $353,000, or 19.0%, from the comparable period in the prior year, due primarily to a decrease in the net gain on sales of mortgage loans as activity decreased due to the increasing interest rate environment. Gain on sales of mortgage loans decreased $325,000, or 52.6%, compared to the prior year quarter as the Company sold $7.2 million of residential mortgage loans in the second quarter of 2022 as compared to $15.3 million in the second quarter of 2021. A net realized loss on the sale of securities of $162,000 in the second quarter of 2022 also contributed to the decrease in non-interest income. These decreases were partially offset by an increase in service charges on deposit accounts of $88,000, or 14.2%, as transaction volume increased.
For the six months ended June 30, 2022, total non-interest income decreased $883,000, or 21.6%. The reduction between periods was mostly due to the decrease in the gain on the sale of mortgage loans of $984,000 or 58.7%, the 2021 one-time gain from the collection of a life insurance claim of $195,000 and a net realized loss in 2022 from the sale of securities of $162,000, partially offset by an increase in service charges on deposit accounts of $185,000, an improvement in investment advisory income of $128,000, a $64,000 increase in the cash value of life insurance, and a net improvement of $83,000 in other income items.
For the second quarter of 2022, non-interest expense totaled $9.5 million, an increase of $609,000, or 6.9%, over the comparable 2021 period. The increase was primarily due to an increase in salaries and benefits of $522,000, or 10.5%, due to the addition of new positions, annual merit increases, production incentives and employee benefit increases, as well as the competitive pressures of the current job market. For the three months ended June 30, 2022, occupancy expenses increased $161,000, or 15.5%, primarily resulting from inflationary pressures on our service contracts. Marketing expense increased by $55,000, data processing costs increased $32,000 and FDIC insurance costs increased $24,000. These increases were partially offset by decreased professional fees of $49,000 and a decrease in other non-interest expenses of $129,000, or 8.4%.
For the six months ended June 30, 2022, non-interest expense totaled $18.6 million, an increase of $1.8 million, or 10.5%, over the comparable 2021 period. The increase was primarily due to an increase in salaries and benefits of $1.4 million, or 15.1%, due to branch expansion, new position openings, annual merit increases, production incentives and employee benefit increases, as well as the competitive pressures of the current job market. For the six months ended June 30, 2022, occupancy expenses increased $305,000, or 15.3%, as a result of the additional rent, depreciation and other expenses related to branch expansion. The addition of branches was also primarily responsible for increased data processing costs of $123,000, increased marketing expense of $84,000 and increased FDIC insurance costs of $35,000. These increases were partially offset by decreased professional fees of $63,000 and a decrease in other non-interest expenses of $178,000, or 6.2%.