B. Todd Jones of Minnesota, President Barack Obama's nominee for director of the Bureau of Alcohol, Tobacco, Firearms and Explosives. (Jacquelyn Martin/AP)

The Senate on Wednesday confirmed a director to head the agency that regulates firearms and investigates gun and explosives crimes, ending an extraordinary seven-year run in which the agency has been without a permanent, full-time leader.

By confirming B. Todd Jones, the U.S. attorney for Minnesota and the acting part-time director of the Bureau of Alcohol, Tobacco, Firearms and Explosives by a vote of 53 to 42, Congress provided the Obama administration with a rare victory in its efforts to advance sweeping gun proposals. None of President Obama’s other legislative initiatives survived the congressional debate that followed the mass shooting in Newtown, Conn., in December.

The National Rifle Association has effectively blocked past nominees to head ATF. But NRA lobbyist Jim Baker said this week that the organization was not going to take a position on Jones and was not using the vote on his nomination to “score” senators, as the organization does with some other votes. The National Shooting Sports Foundation, the group that represents firearms manufacturers, also threw its support behind Jones this week.

“While we have at times strongly disagreed with the policy and regulatory positions and interpretations ATF has taken during Mr. Jones’ tenure as acting director, we have never found Mr. Jones himself to be disagreeable,” the NSSF’s general counsel, Lawrence Keane, wrote in a letter Wednesday to Senate Majority Leader Harry Reid (D-Nev.) and Minority Leader Mitch McConnell (R-Ky). “Under Mr. Jones’ leadership, ATF has always listened to our concerns and issues with an open mind.”

Obama, in a statement issued Wednesday night, said Senate Republicans had refused to confirm an ATF director before “because they put politics ahead of the agency’s law enforcement mission,” and applauded a bipartisan group of senators “who broke through that gridlock to give Todd Jones the up or down vote he deserved.”

The confirmation vote came after a months-long debate over the nomination of Jones, a federal prosecutor and former Marine who was appointed to head ATF in September 2011, after the agency was rocked by controversy over the “Fast and Furious” gun-trafficking operation.

It also turned into a political cliffhanger. The Senate had to keep open a procedural vote for nearly four hours until one member returned from out of state to cast her vote in favor of closing debate on the nomination. Without the appearance by Sen. Heidi Heitkamp (D-N.D.), Democrats would have been one vote short of the 60 needed to prevent a Republican filibuster.

The ATF has been without a full-time director since 2006, when the NRA lobbied Rep. F. James Sensenbrenner Jr. (R-Wis), then chairman of the House Judiciary Committee, to insert a provision into the Patriot Act reauthoization to changed the position of ATF director from one appointed by the administration to one confirmed by the Senate.

Michael J. Sullivan, a former U.S. attorney in Boston, was nominated by President George W. Bush to head ATF. He was blocked by three senators who accused ATF of being hostile to gun dealers. In his first term, Obama nominated Andrew Travers, who headed ATF’s Chicago field office, but after the NRA vowed to fight the nomination, it went nowhere.

The Senate vote to end the debate on Jones began about 2 p.m. Wednesday. A critical vote was made by Sen. Lisa Murkowski (R-Alaska) who switched her vote to end the debate from no to yes after an extended period of discussion on the floor of the Senate with a bipartisan group of Senate Judiciary Committee members. Her switch gave the Senate 59 of the 60 votes needed to end debate. But it wasn’t until about 7 p.m. that Heitkamp cast her vote to prevent a Republican filibuster and allow a confirmation vote.

A spokesman for Heitkamp said she hadn’t been able to return earlier from North Dakota because she was sick. Once Heitkamp voted to end debate, the Senate moved to get a simple majority vote to confirm Jones, which they finally did by a roll call that ended at 7:35 p.m.

Sen. Charles E. Grassley (R-
Iowa) called the vote “totally irresponsible,” citing an open complaint against Jones for alleged whistleblower retaliation in his position as U.S. attorney for Minnesota.

“It’s too bad that after the Obama administration left the position open for more than four years, a person who is alleged to have retaliated against a whistleblower is now the director of an agency that could use a lot more whistleblowers to help clean it up,” Grassley said in a statement.

Former astronaut Mark Kelly, who founded Americans for Responsible Solutions with his wife, ex-congresswoman Gabrielle Giffords (D-Ariz.), praised the vote, saying, “It took seven years — and a little drama on the Senate floor today — but in the end, the Senate listened to the American people over the gun lobby.”

Paul Kane contributed to this report.