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.