Updated

The Senate approved Chuck Hagel's nomination for Defense secretary Tuesday, ending a contentious battle that exposed deep divisions over the president's Pentagon pick.

After Republicans blocked the nomination earlier this month, they ultimately allowed for an up-or-down vote on Tuesday. The margin was historically close, with 58 senators supporting him and 41 opposing in the end.

Though Hagel is himself a former Republican senator, the resistance to his nomination showed an unusual level of distrust among many senators toward the man chosen to lead the Defense Department -- at a time when the country is trying to wind down the Afghanistan war, while assessing emerging threats from Iran, Syria and elsewhere in the turbulent Middle East and North Africa.

Republicans had earlier held up the nomination largely over demands for more information from the Obama administration on the Sept. 11 Libya attacks.

But they also raised serious and recurring concerns about Hagel's record of past statements and votes on everything from Israel to Iran to nuclear weapons.

Sen. John McCain, a leading Republican, clashed with his onetime friend over his opposition to President George W. Bush's decision to send an extra 30,000 troops to Iraq in 2007 at a point when the war seemed in danger of being lost. Hagel, who voted to authorize military force in Iraq, later opposed the conflict, comparing it to Vietnam and arguing that it shifted the focus from Afghanistan.

McCain called Hagel unqualified for the Pentagon job even though he once described him as fit for a Cabinet post.

Senate Majority Leader Harry Reid asked what the delaying tactics had done for "my Republican colleagues."

"Twelve days later, nothing. Nothing has changed," the Democrat said on the Senate floor. "Sen. Hagel's exemplary record of service to his country remains untarnished."

Reid blamed partisanship over Obama's second-term national security team for the delay. Both Reid and Senate Armed Services Committee Chairman Carl Levin, a Democrat, warned that it was imperative to act just days before automatic, across-the-board budget cuts hit the Pentagon.

Hagel will succeed Defense Secretary Leon Panetta and join Obama's retooled national security team. Hagel's nomination bitterly split the Senate, with Republicans turning on their former party colleague and Democrats standing by Obama's nominee.

Republicans also challenged Hagel about a May 2012 study that he co-authored for the advocacy group Global Zero, which called for an 80 percent reduction of U.S. nuclear weapons and the eventual elimination of all the world's nuclear arms.

The group argued that with the Cold War over, the United States can reduce its total nuclear arsenal to 900 without sacrificing security. Currently, the U.S. and Russia have about 5,000 warheads each, either deployed or in reserve. Both countries are on track to reduce their deployed strategic warheads to 1,550 by 2018, the number set in the New START treaty that the Senate ratified in December 2010.

In an echo of the 2012 presidential campaign, Hagel faced an onslaught of criticism by well-funded, Republican-leaning outside groups that labeled the former senator "anti-Israel" and pressured senators to oppose the nomination. The groups ran television and print ads criticizing Hagel.

Opponents were particularly incensed by Hagel's use of the term "Jewish lobby" to refer to pro-Israel groups. He apologized, saying he should have used another term and should not have said those groups have intimidated members of the Senate into favoring actions contrary to U.S. interests.

The nominee spent weeks reaching out to members of the Senate, meeting individually with lawmakers to address their concerns and seeking to reassure them about his policies.

Hagel's halting and inconsistent performance during some eight hours of testimony at this confirmation hearing last month undercut his cause, but it wasn't a fatal blow.

There was no erosion in Democratic support for the president's choice and Hagel already had the backing of three Republicans -- Sens. Thad Cochran, Mike Johanns and Richard Shelby. Sen. Rand Paul, R-Ky., also switched to support Hagel in the final vote.

The Associated Press contributed to this report.