The Senate on Thursday confirmed President Obama's choice to run the Pentagon, handing Ashton Carter the unenviable task of steering the military as the United States confronts Islamic State militants, conflict in Ukraine and other worldwide threats. 

The vote in the Republican-controlled Senate was 93-5. Carter will replace Chuck Hagel, the former Republican senator who had a rough relationship with Obama's insular group of national security advisers. 

Carter will be Obama's fourth defense secretary in six years, joining a line of succession that began with Robert Gates and included Leon Panetta and Hagel. 

One of Carter's first tasks will be helping to win support for Obama's call to Congress for new authority to use force against the IS extremists. Republicans and Democrats have reacted negatively to Obama's draft proposal, criticizing both its limitations and vagueness. 

In endorsing the 60-year-old Carter, Republicans expressed little hope that he would have better success in jelling with Obama's inner circle than Hagel did. The former Republican senator and Vietnam War veteran was often the outsider and he announced in November he was stepping down. 

The president's relationship with the Pentagon has often been strained. 

Senate Majority Leader Mitch McConnell, R-Ky., who backed Carter, said he "needs to have the courage to speak truth to power -- to Congress, yes, but also to his commander in chief." 

Sen. John McCain, R-Ariz., chairman of the Armed Services Committee, alluded to the divide between the White House and Pentagon, saying he had "sincere hope and, sadly, little confidence that the president who nominated Dr. Carter will empower him to lead and contribute to the fullest extent of his abilities." 

While moving ahead on Carter, Senate Republicans delayed a committee vote on Loretta Lynch, Obama's nominee for attorney general. Lawmakers said they had more questions for Lynch, the U.S. attorney for the eastern district of New York who would become the nation's first black female attorney general if confirmed. 

Democrats complained that Lynch is being held to a double standard compared to other nominees and said her nomination should be approved immediately. Her confirmation is expected after Congress' one-week recess. 

Carter served as the Pentagon's second-ranking official from 2011 to 2013, spent two years previously as the department's technology and weapons-buying chief and was assistant secretary of defense for international security policy during Bill Clinton's administration. He prefers to be called Ash rather than his given name, Ashton. 

The next Pentagon chief faces a long to-do list for a military looking at reduced budgets and crises worldwide. The Islamic State group has claimed large swaths of Iraq and Syria. Russian-backed separatists threaten Ukraine. The war is winding down in Afghanistan after more than a decade of fighting, but there is widespread debate about whether the residual U.S. force is sufficient to protect gains. 

At his confirmation hearing last week, McCain told Carter he hoped he would push back on any attempt by the White House to micromanage the Defense Department, or over-centralize U.S. foreign and defense policies. 

"I'll be entirely straight and upfront with the president and make my advice as cogent and useful to him in making his decisions as I can," Carter promised. 

Carter told the committee he was inclined to support providing defensive lethal aid to Ukrainians battling Russian-backed separatists. He also said he would consider recommending a change of plans for withdrawing all U.S. troops from Afghanistan by the end of 2016 if security conditions worsen. About 10,600 U.S. troops remain in Afghanistan. 

Carter said 2,106 American service members have lost their lives in Afghanistan. "Finishing the job there is very important," he said.