– The Senate overwhelmingly confirmed Mark Esper as secretary of defense on Tuesday, ending the longest period by far that the Pentagon had been without a permanent leader.

Esper, an Army infantryman who fought in the Persian Gulf War of 1991 before becoming a lobbyist for military contractor Raytheon, replaces Jim Mattis, who resigned in December during a dispute over pulling U.S. troops out of Syria.

In receiving the lopsided 90-8 Senate nod, Esper succeeded where Patrick Shanahan, President Donald Trump's original pick to replace Mattis, did not; Shanahan abruptly resigned last month, before his Senate confirmation hearing was even scheduled, after news reports revealed details of his 2011 divorce.

Esper, 55, now takes control of the country's 1.2 million active-duty troops and one of the largest militaries in the world as the Trump administration is wrestling with the results of its so-called maximum pressure campaign of economic sanctions on Iran, which has prodded the two adversaries closer to military confrontation.

"Having a Senate-confirmed secretary of defense, especially one of this quality, could not come a moment too soon," Sen. Mitch McConnell, R-Ky., the Senate majority leader, said in a floor speech Tuesday. He called Esper a "well-prepared nominee" who will face a world "full of serious threats to America, to our allies and to our interests."

Esper will add his voice to the senior Trump national security advisers seeking to influence the president on a range of issues, including how to end the war in Afghanistan, and how to negotiate with Turkey, a longtime NATO ally, as it defies American wishes in buying a missile system from Russia.

How influential Esper will be is one of the biggest questions facing the new defense secretary. Mattis was widely viewed as a voice of reason and global stability in a chaotic administration, but those very views helped to poison his relationship with Trump and led to his resignation.

Esper joins Trump's senior advisers with a solid background in military affairs and a broad understanding of the alliances that the United States has maintained throughout the Cold War era. But the exit of Mattis and the Pentagon's seven months without a permanent secretary have diminished the department's voice in internal White House meetings.

Meanwhile, National Security Adviser John Bolton and Secretary of State Mike Pompeo — who was a former West Point classmate of Esper — have largely run national security policy in the months since Mattis departed. Esper's challenge, national security experts said, will be to work to get the Pentagon's views represented among those strong personalities.

"The protracted period without a permanent defense secretary has created a vacuum," Carl Tobias, a law professor at the University of Richmond, said in an e-mail. "That situation has decreased DOD's influence on critical matters involving national security and military affairs and limited DOD's ability to affect important policymaking generally and on specific issues," especially Iran, China and North Korea.

"The president needs the best advice, particularly on national security, from numerous perspectives, partly as a counterbalance to the apparently outsized recent influence being exercised by Pompeo, Bolton and perhaps others in the White House and Trump's orbit," Tobias said. He said that need "may help explain the unusually bipartisan, overwhelming confirmation vote that Esper secured."

Indeed, Esper's confirmation process was largely fast and smooth, reflecting lawmakers' eagerness for stability at the Pentagon.

But during his confirmation hearing, some Democrats raised questions about Esper's ties to the defense industry.

In fact, five of the eight senators — all Democrats — voting against Esper are presidential aspirants in 2020: Cory Booker of New Jersey, Kirsten Gillibrand of New York, Kamala Harris of California, Amy Klobuchar of Minnesota and Elizabeth Warren of Massachusetts.