The attorney general Eric Holder has become the first sitting member of a president's cabinet in US history to be held in contempt of Congress after Republicans vented their fury over a bungled gun-tracking investigation.

Seventeen Democrats, under pressure from the pro-gun lobby the NRA, joined 238 Republicans to carry a criminal contempt resolution against Holder. A currently serving attorney general has never before been censured in this way.

The criminal contempt resolution, passed by 255 to 67, with most Democrats walking out of the chamber en masse before the vote, related to Operation Fast and Furious, a federal investigation launched in Arizona designed to ensnare gun smugglers involved with the Mexican drug cartels.

Thursday's vote was of symbolic value, pointing to the almost total collapse of trust between the two main parties in Congress. Republican anger has been fueled by a conspiracy theory that Fast and Furious was deliberately set up to fail by the Obama administration to pave the way for greater federal gun controls.

Holder delivered an angry statement about 20 minutes after the contempt vote, accusing the Republican leadership of engaging in "election-year politics and gamesmanship". He said the charges against him were "unnecessary and unwarranted" and insisted that as soon as he learnt about flawed tactics of Fast and Furious he had taken action to stop it and make sure such methods were never used again.

"That was my response to Fast and Furious, and any suggestion to the contrary is not consistent with the facts," he said, adding that the Republican leadership was advancing "truly absurd, truly absurd conspiracy theories".

John Boehner, the speaker of the House, said: "I don't take this matter lightly. I hoped it would never come to this – but no justice department is above the law and the constitution."

Democrats responded by accusing the Republican group in the House of engaging in political hystrionics. John Dingell, a Democrat from Michigan who is a former board member of the NRA, accused the Republicans of engaging in a "partisan political witch-hunt with the attorney general as its target".

In legal terms the vote is of doubtful practical significance as the contempt issue will now be handed to the US attorney for the District of Columbia – a prosecutor who, as an official within Holder's department of justice, is unlikely to proceed with a case against his own employer.

In a second vote, the House passed a civil contempt resolution by 258 to 95. That too has limited practical implications. The civil contempt motion will allow the House to proceed to the courts to ask them to force Holder to release the disputed documents, but judges rarely agree to intervene in cases where the president has already invoked executive privilege.

Operation Fast and Furious went awry after agents of the Bureau of Alcohol, Tobacco, Firearms and Explosives practised a controversial technique known as "gun-walking", where low-level smugglers were allowed to traffic weapons in the hope that bigger fish could be caught further down the line.

About 1,400 of the 2,000 guns involved went missing, and two were found at the scene of the killing of a US border agent, Brian Terry. During the debate leading up to the contempt vote, Republican speakers repeatedly referred to the wishes of the Terry family to seek the truth.

The dramatic standoff between the Obama administration and the Republican-controlled House has been provoked by demands that the department of justice hands over thousands of official documents. The Republicans believe the files will show that Holder and other senior administration officials were complicit in the gun-walking and that they tried to cover it up. The DoJ has refused to hand over the documents, saying they are irrelevant to the operation and pointing out that they have already disclosed about 7,600 documents that do relate directly to Fast and Furious.

Last week Obama invoked executive privilege to block the disclosure of the internal documents.

In the runup to the vote, members of both parties from the House oversight and government affairs committee were shown emails to and from Holder relating to Fast and Furious. The correspondence dated from February 2011 – precisely the moment when the administration wrongfully told Congress that there had been no gun-walking to Mexico, a false statement that it retracted 10 months later.

The newly disclosed emails, details of which were obtained by Associated Press, appeared to support the attorney general's insistence that at that time he was unaware that guns had been allowed to "walk" at the time. On 23 February, three weeks after the administration denial had been made, Holder wrote to his officials following new revelations in the media to say: "We need answers on this. Not defensive BS. Real answers."

On 3 March, Holder's deputy, James Cole, sent an email to all his officials saying: "We obviously need to get to the bottom of this."

• This article was amended on 29 June 2012. The original said that fifteen Democrats joined 238 Republicans to carry a criminal contempt resolution against Holder. This has been corrected.