Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

As many Republican leaders abandon Donald Trump — and some donors ask for their money back — one deep-pocketed supporter has remained generous and steadfast: the National Rifle Association.

The NRA is spending more than it ever has on elections this year — more than $36 million at last count, with another four weeks until Election Day, according to the Center for Responsive Politics.

And Trump is by far the largest beneficiary, with the NRA spending more than $21 million to help him: $9.6 million on ads and other pro-Trump materials, and another $12 million attacking Hillary Clinton, whom the organization sees as a threat to nominate a Supreme Court justice seen as unsympathetic to gun rights.

Several million more have gone toward Senate races, part of an effort by the NRA to prevent, in the case of a Clinton victory, Congress from approving such a nominee, which its says could lead to a reversal of a landmark 2008 Supreme Court decision that upheld an individual's right to bear arms.

Republican presidential candidate Donald Trump attends the National Rifle Association's NRA-ILA Leadership Forum during their annual meeting in Louisville, Kentucky on May 20, 2016. AARON P. BERNSTEIN / Reuters, file

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"The stakes have never been higher for law abiding gun owners and people who support the Second Amendment," NRA spokeswoman Jennifer Baker said.

The new NRA spending figures were first reported by The Trace, a news site focusing on gun issues.

The pro-Trump/anti-Clinton spending split seems to reveal some of the nuance behind the NRA's stance. Before his candidacy, Trump made remarks in support of gun control, but spoke forcefully for gun rights during the primaries. The NRA endorsed Trump in May. But the group has been motivated against Clinton for much longer.

Clinton has advocated for gun control but has also said she supports the Second Amendment.

.@HillaryClinton would nominate more anti-#2A judges who will vote to overturn your right to own a gun for self-defense! pic.twitter.com/vC1W3jVM6M — NRA (@NRA) October 11, 2016

The NRA calls Trump one of the most pro-gun presidential candidates in history. But its NRA ads have focused less on praising him than on raising concerns of a Clinton presidency. Several have featured young women who fear losing their ability to defend themselves.

Last week, the NRA's political arm announced it was launching a $6.5 million pro-Trump ad campaign featuring a woman who says she fought off an attacker with her pistol.

That followed a $3 million ad buy in August, soon after Trump incited controversy by remarking that "Second Amendment people" could stop Clinton from making an unfavorable judicial nomination.

But as the NRA has become one of Trump's biggest campaign benefactors, it has branched out beyond strictly gun issues. Its first ad of the campaign had nothing to do with guns at all — it featured a survivor of the 2012 Benghazi terror attack warning of a Clinton presidency.

The NRA's $36 million in spending in this campaign eclipses that of any other election cycle, and is up from $27 million in the 2014 cycle, according to Center for Responsive Politics data.

The current total makes the NRA the sixth biggest-spending PAC in the 2016 cycle, behind a group of super PACs focused on particular candidates.