Chuck Hagel's confirmation came Tuesday afternoon. | John Shinkle/POLITICO Senate confirms Chuck Hagel 58-41

A divided Senate on Tuesday finally confirmed Chuck Hagel as secretary of Defense, handing President Barack Obama a victory on one of his key Cabinet appointments after weeks of partisan rancor.

The former Republican senator from Nebraska, who is expected to be sworn in on Wednesday, will take the reins at the Pentagon as some 66,000 Americans serve in the ongoing war in Afghanistan and just days before automatic, across-the-board spending cuts are set to kick in on Friday.


( PHOTOS: Chuck Hagel's career)

His confirmation, approved 58-41, required only a simple majority after the Senate voted 71-27 earlier in the day to end debate. Four Republicans joined Democrats in confirming Hagel: Thad Cochran of Mississippi, Mike Johanns of Nebraska, Richard Shelby of Alabama and Rand Paul of Kentucky.

"I've said all along I give the president some prerogative in choosing his political appointees,” Paul said. “There are many things I disagree with Chuck Hagel on ... but the president gets to choose political appointees.”

Hagel needed at least 60 votes to clear the day’s earlier procedural hurdle, in which 18 Republicans joined 53 Democrats to end debate.

As the vote approached after Republicans blocked the first nearly two weeks ago, Senate Majority Leader Harry Reid bemoaned all the delays, arguing Republicans had accomplished nothing.

( WATCH: Top 5 controversial Chuck Hagel positions)

“Twelve days ago the Republicans mounted a first of its kind filibuster on Sen. Hagel’s nomination. ... What has the filibuster gained my Republican colleagues? Twelve days later, nothing,” Reid said on the Senate floor. “Politically motivated delays send a terrible signal to our allies around the world, and they send a terrible signal to tens of thousands of Americans serving in Afghanistan, other parts of the world and … in the United States.”

Still, even as they approached the vote they knew they’d lose, key Republicans stuck by their opposition. Sen. Jim Inhofe of Oklahoma, the ranking Republican on the Senate Armed Services Committee, said he’d asked Defense Secretary Leon Panetta to stay on — or that he’d prefer former undersecretary of Defense for policy Michèle Flournoy or Deputy Defense Secretary Ash Carter — to Hagel.

And Sen. Dan Coats of Indiana and Minority Whip John Cornyn of Texas both said the lingering controversy over Hagel was evidence in its own right that he should not take over the Pentagon.

“Sen. Hagel is clearly the wrong man for the job,” Cornyn said. “This isn’t about personality. This isn’t about politics. … He is the wrong man for the job.”

Tuesday’s Senate vote was Democrats’ second attempt to clear a Republican barricade; the first on Feb. 14 fell short when Republicans said they wanted “more time” to review Hagel’s disclosures. And that roadblock came after calls by Republicans to delay Hagel’s committee vote, which succeeded for a few days before a close, party-line result — rare for the usually bipartisan Armed Services Committee.

Republicans fought Hagel’s nomination as few Defense secretary nominees have ever been contested, angry over what they perceived as his betrayal on the Iraq War, past comments about Israel and Iran and what the GOP saw as dovish positions on defense spending and nuclear weapons.

Republicans blasted Hagel in his Jan. 31 confirmation hearing, for which he was widely panned, and House Armed Services Committee Chairman Rep. Buck McKeon (R-Calif.) urged President Barack Obama to nominate someone else.

Sen. John McCain (R-Ariz.) insisted the GOP strategy on Hagel was partly chickens coming home to roost, reminding reporters that Democrats had delayed Defense secretary nominee John Tower for three months in 1989 and had blocked other nominees in the past.

And Inhofe initially had told POLITICO in December that he “would look forward to supporting” Hagel if nominated but upon closer examination of the nominee’s record quickly reversed course and became one of the nominee’s most vocal critics. Ultimately, McCain and other Republicans relented and agreed to end debate and move ahead to a confirmation vote.

Still, although Hagel’s opponents were not able to get him to withdraw, they called the prolonged process a success.

“In order to get Hagel barely across the finish line, the president had to burn up a tremendous amount of political capital to keep pro-Israel and vulnerable Democrats in line while Hagel was forced to disavow every position he’s ever held that endeared him to foreign policy leftists,” argued one senior Republican Senate aide. “Bottom line: a weakened White House gets a marginalized secretary of Defense who had to disavow all of his views and supporters in order to win confirmation. I’d call that a win for the opposition.”

This article first appeared on POLITICO Pro at 12:38 p.m. on February 26, 2013.