After a tough two-month battle characterized by tough interrogation and a partisan divide, the Senate voted 58-41 to confirm Chuck Hagel -- President Obama's nominee -- as secretary of defense this afternoon.

Only four Republicans broke party lines to vote in Hagel's favor. They included Sens. Thad Cochran of Mississippi, Richard Shelby of Alabama, Mike Johanns of Nebraska and Rand Paul of Kentucky, though Paul had voted against moving forward with the vote earlier today.

Before that cloture vote to close the debate and bring Hagel's nomination to a vote, Senate Majority Leader Harry Reid, D-Nev., warned Republicans against continuing their partisan fight against the nominee.

"Senate Republicans have delayed for the better part of two weeks for one reason: partisanship," Reid said. "Politically motivated delays send a terrible signal to allies around the world, and they send a terrible signal to tens of thousands of Americans serving in Afghanistan, other parts of world and those valiant people who are serving here in the United States. For the sake of national security, it's time to set aside this partisanship."

The measure to move forward passed by a vote of 71-27. It needed at least 60 votes to pass.

Some Republican senators took the time before the vote to take a last stab at Hagel.

John Cornyn, R-Texas, who was one of 15 senators who sent a letter to Obama last week calling for him to withdraw his nomination of Hagel, said Hagel had proved that he's ill-prepared to assume the defense secretary post.

"There's simply no way to sugar coat it," Cornyn said. "Sen. Hagel's performance before the Senate Armed Services Committee was remarkably inept, and we should not be installing a defense secretary who is obviously not qualified for the job and who holds dangerously misguided views on some of the most important issues facing national security policy for our country. Sen. Hagel is clearly the wrong man for the job."

The Senate returned today after a week off from debating Hagel's pros and cons.

Today's was not the first attempt to bring Hagel's nomination to the floor.

Republicans blocked a cloture vote to confirm Hagel on Valentine's Day, pushing the decision back until after their President's Day recess.

Democrats framed that rejection as a filibuster, while Republicans said they needed another week to discuss the candidate's record.

"This is a very controversial nominee. There is a desire to not end debate now," Sen. Lindsey Graham, R-S.C., said that Thursday. "We feel like come back next week, after the break, unless there is some bombshell I'd be ready to move on to vote."

Ten days later, GOP Sens. Tom Coburn of Oklahoma and John McCain of Arizona predicted the Senate would go through with a vote today.

A group of 15 Republicans sent a letter to Obama last week asking him to withdraw Hagel's nomination. Coburn, one of the senators who signed that letter, said the fight among lawmakers over Hagel's qualifications would weaken him should he become secretary.

"I like Chuck Hagel as an individual, but the fact is, in modern times, we haven't had one defense secretary that's had more than three votes against him," Coburn said on "Fox News Sunday" this weekend. "And you're going to have 40 votes against him, or 35 votes. And that sends a signal to our allies as well as our foes that he does not have broad support in the U.S. Congress, which limits his ability to carry out his job."

McCain did not sign that letter.

"I do not believe that Chuck Hagel, who is a friend of mine, is qualified to be secretary of defense, but I do believe that elections have consequences -- unfortunately," McCain told CNN's Candy Crowley Sunday on "State of the Union," explaining why he chose not to sign. "And the president of the United States was re-elected."

Obama announced his support for Hagel two weeks before the kick-off of his second term.

Hagel is a former GOP senator from Nebraska and Purple-Heart-decorated Vietnam veteran.His confirmation today makes him the first former enlisted member of the Armed Forces to serve as secretary of defense, but he has been an unpopular pick from the start, with groups claiming he was anti-Israel and anti-gay rights.

The hearings over Hagel's nomination have had tense moments, with many serious accusations and at least one bordering on the bizarre.

Republicans have raised questions about Hagel's finances. A letter signed by 20 senators faulted Hagel for failing to disclose information about compensation he and organizations he worked with received during the last decade.

McCain also accused Hagel of being on "the wrong side of" history for his opposition to President Bush's 2007 surge of American troops in Iraq.

A conservative website attacked Hagel for taking money from a group called "Friends of Hamas," which was later revealed to be an imaginary entity dreamed up by New York Daily News reporter Dan Friedman.

Hagel takes the place of departing Defense Secretary Leon Panetta.

In his farewell message, Panetta called leading the Defense Department "the privilege of my life," and said he's most proud of the progress made in ending the wars in Iraq and Afghanistan, success in weakening al Qaeda and developing a defense strategy based on "fiscal discipline." In a nod to ending "don't ask, don't tell" and the ban on women in combat, Panetta also said he was proud that in his tenure the Pentagon expanded "opportunities for everyone in the military, because I believe everyone deserves a chance to serve."