NEW YORK — The longtime head of the National Rifle Association said Friday that he is resigning, just days before the start of a civil trial over allegations he diverted millions of dollars from the powerful gun rights organization to pay for personal travel, private security and other lavish perks.

Wayne LaPierre, executive vice president and chief executive officer, said his departure is effective Jan. 31.

The trial in New York Attorney General Letitia James’ lawsuit against him, the NRA and others who’ve served as executives is scheduled to start Monday. LaPierre is among the witnesses expected to testify. The NRA said it will continue to fight the lawsuit.

“With pride in all that we have accomplished, I am announcing my resignation from the NRA,” LaPierre said in a statement released by the organization, which said he was exiting for health reasons. “I’ve been a card-carrying member of this organization for most of my adult life, and I will never stop supporting the NRA and its fight to defend Second Amendment freedom. My passion for our cause burns as deeply as ever.”

James, a Democrat, heralded LaPierre’s resignation as an “important victory in our case” and confirmed that the trial will go on as scheduled.

Andrew Arulanandam, a top NRA lieutenant who has served as LaPierre’s spokesperson, will assume his roles on an interim basis, the organization said.

LaPierre, 74, has led the NRA’s day-to-day operations since 1991, acting as the face and vehement voice of its gun rights agenda and becoming one of the most influential figures in shaping U.S. gun policy.

In recent years though, the NRA has been beset by financial troubles, dwindling membership and infighting among its 76-member board, along with lingering questions about LaPierre’s leadership and spending.

In 2021, at LaPierre’s direction, the NRA filed for bankruptcy and sought to incorporate in Texas instead of New York — but a judge rejected the move, saying it was a transparent attempt to avoid culpability in James’ lawsuit.

Gun control advocates lauded LaPierre’s resignation, mocking his oft-repeated talking point in the wake of myriad mass shootings over the years.

“Thoughts and prayers to Wayne LaPierre,” said Kris Brown, president of the gun control advocacy group Brady. “He’s going to need them to be able to sleep at night. Wayne LaPierre spent three decades peddling the Big Lie that more guns make us safer — all at the expense of countless lives. He has blood on his hands, and I won’t miss him.”

James’ lawsuit accuses LaPierre and other executives of abusing their power and spending tens of millions of dollars in organization funds on personal trips, no-show contracts and other questionable expenditures.

The suit claims LaPierre spent millions on private jet flights and personal security and accepting expensive gifts — such as African safaris and use of a 107-foot yacht — from vendors.

He is also accused of setting himself up with a $17 million contract with the NRA if he were to exit the organization, spending NRA money on travel consultants, luxury car services, and private jet flights for himself and his family — including more than $500,000 on eight trips to the Bahamas over a three-year span.

Phillip Journey, an ex-NRA board member who clashed with LaPierre and is expected to testify at the New York trial, said LaPierre’s resignation doesn’t resolve open questions before the court or fix persistent rot within the organization.

Journey also testified at the NRA’s bankruptcy trial in Texas and said he anticipates that there is enough evidence for James to prove her case.

“It’s a tragic end to a career that had many high points,” Journey said of LaPierre stepping down. “It’s one of his own making.”