All but three of the 45 senators who torpedoed gun control measures in Congress on Wednesday have received money from firearms lobbyists, according to new analysis by the Guardian and the Sunlight Foundation.

Some, such as Indiana Republican Dan Coats, registered donations from pro-shooting groups as recently as three weeks ago, when the proposal to extend background checks was still seen as likely to pass.

President Obama and congresswoman Gabby Giffords, who survived a gun attack, have both accused the Senate of being in thrall to gun money following Wednesday's vote. "They worried that the gun lobby would spend a lot of money and paint them as anti-second amendment," said Obama.

Yet campaign disclosures show the group were also direct recipients of gun cash. The National Rifle Association alone has given $800,000 to 40 of the senators who voted against the amendment since 1990, much of it in the run-up to the last election, according to Sunlight Foundation figures.

Information for the period since the Newtown school shooting is harder to come by because many quarterly filings due out on Tuesday have been delayed by the suspected ricin attack on members of Congress.

But Guardian analysis of the data available so far for 2013 reveals that some groups have continued to be active outside the election cycle – including Safari Club International, a pro-hunting organisation which gave $1,000 to Senator Coats on 29 March, according to the filings.

Documents also show the NRA saw a surge in donations to its lobbying arm in the months following Newtown – registering a record $2.7m in cash during January and February. Further disclosures showing the scale of its recent donations, particularly to politicians in the House of Representatives, are expected on Saturday.

The Gun Owners of America and National Association for Gun Rights – two groups seen as more conservative than the NRA – have also been active in the Senate, giving $9,000 and $5,000 respectively to Ted Cruz, one of the leaders of Republican opposition to the amendment.

Others to receive arms-related donations recently include Senator Richard Burr of North Carolina, who received $1,000 on 4 March from BAE Systems, a British defence group that manufacturers ammunition, although mostly for military purposes.

Some of the more relevant donations do not come explicitly from gun campaigners. Senator Jeff Flake, a crucial swing voter from Arizona who turned against gun control at the last minute, received $5,000 in 2012 from The Madison Project, a right-wing campaign group that lists gun rights as one of its top priorities. On 9 April, it warned against Republicans such as Flake, who voted for the gun debate, and urged members to call these senators and "tell them that when the Bill of Rights reads 'shall not be infringed' with regards to the second amendment, it means exactly that".

Though the sums are relatively small they indicate the range of lobbying targets pursued by groups such as the NRA, which spent $8.5m before the last election on television ads and telephone drives. Far more money is spent on negative attack ads against politicians seen as weak on gun rights, than in favour of supporters.

Analysis of so-called 'dark money', or undisclosed expenditure, by the Sunlight Foundation shows the NRA was behind at least five TV ad campaigns against gun control since Newtown, targeting key swing states such as Ohio.

Kathy Keily, a campaign finance expert with Sunlight, said: "Keep in mind that the power of the NRA is to a considerable degree fear-based. So it's not just how much they've given to support a politician but how much they might give to oppose."

Such thinking may have influence the handful of Democrats, such as Mark Pryor of Arkansas, who voted against the amendment, says Keily. Pryor received $1,000 from the Safari Club before the last election, but none from the NRA.

Only three senators who voted against the measure have not declared any donations from gun lobbyists – Democrats Mark Begich and Heidi Heitkamp and Republican Rand Paul – although 2013 quarterly data for Begich does not appear to have made it through the congressional mail backlog. Rand Paul was recently found to have close family ties to the National Association for Gun Rights.

A growing number of groups in favour of gun control have also been spending money in recent months, including Michael Bloomberg's Mayors Against Illegal Guns, but analysis of its campaign funding shows it to be dwarfed by the NRA.

The NRA has also tightened the screws on senators in recent days by taking the unprecedented decision to award negative scores to anyone who voted for a motion allowing the gun debate to go ahead. These scores are widely used during elections to show adherence to the gun cause.

Republican senators and the NRA both said they opposed the amendment on background checks because it would be a "slippery slope" to a national register of gun owners and would add burdensome delays and costs to gun purchases. They favoured measures to improve school safety and prosecutions of violent criminals instead.

Get the data here © Guardian News and Media 2013