Profit at Texas Capital Bancshares spiked upward in the first quarter as improvement in the energy sector allowed the Dallas company to reduce its loan-loss provision by more than two-thirds.

The $21 billion-asset company’s net income rose 77% from a year earlier to $40.1 million. Earnings per share were 80 cents, meeting the average estimate of analysts compiled by FactSet Research Systems.

Clearing the decks: Texas Capital has charged off $23.4 million of bad energy loans in the past two quarters. Bloomberg News

The provision for credit losses fell 70% to $9 million. Chargeoffs of bad oil and gas and other loans, as well as the ability of some troubled borrowers to resume payments, have helped stabilize lending portfolios, Texas Capital said in a press release Wednesday. Texas Capital has charged off $23.4 million of bad energy loans in the past two quarters alone.

Net interest income after the provision rose 34% to $154 million. Total loans rose 2% to $17.6 billion, and the net interest margin rose 16 basis points to 3.29%.

Mortgage finance loans held for investment fell 32% to $3.4 billion due to lower refinance volumes as a result of rising interest rates.

Fee income rose 51% to $17 million on higher mortgage-servicing income, swap fees, brokered loan fees and deposit-service charges.

Noninterest expenses increased 22% to $106 million because of higher salaries, marketing and legal costs and higher expenses related to mortgage servicing.