Defense secretary nominee James Mattis identified Russia as a top security threat to the United States, dismissed his past comments critical of women in combat roles and promised to keep the military "the best equipped and most lethal force in the world," in his Senate confirmation hearing Thursday.

After weeks of controversy surrounding his selection for the top Pentagon post, the 66-year-old retired Marine Corps general faced a largely friendly reception from members of the Senate Armed Services Committee at the event, with Republicans praising his 44-year military career and most Democrats calling him a welcome check on President-elect Donald Trump.

Most of his most difficult questions revolved around the counsel he'll give to the incoming president, a novice to Washington bureaucracy and national security strategy, and whether Trump will listen.

Mattis said bluntly that "I would not have taken the job if I believed (he) would not be open to my advice" and promised to offer candid military advice to both Trump and Congress.

The former head of U.S. Central Command is a popular figure in the ranks, both for his colorful quotes and scholarly approach to military strategy.

Lawmakers have expressed concerns about separating his military experience from the civilian role of defense secretary, and will have to approve a waiver allowing him to get around the mandatory seven-year "cooling off" period between military service and the defense Cabinet post.

Mattis worked to assuage those concerns on Thursday, noting that the top civilian job in the Defense Department mandates a careful balancing of military and diplomatic solutions.

"We shouldn’t be turning to the military to answer all of our problems in the world," he said.

But he also pledged that his top priority if confirmed "will be to strengthen military readiness," nothing that "our military is the envy of the world, representing America’s awesome determination to defend herself."

Mattis said doing that will require undoing defense budget caps to free up military spending plans, echoing promises made by Trump on the campaign trail.

"We don’t want a military that breaks the bank, but we can’t solve our debt problems on the backs of the military alone," he said. "We’re going to have to make hard calls."

That includes to-be-announced business reforms for the Department of Defense and "instilling budget discipline and holding our leaders accountable" on budget issues, he told lawmakers.

In the wake of allegations of Russian interference in the U.S. presidential election, Mattis faced tense questioning about the former Cold-War adversary from several lawmakers, including committee chairman Sen. John McCain, R-Ariz.

"Each of our last three presidents has had great expectations of building a partnership with the Russian government," he said, referencing similar promises by Trump. "Each attempt has failed, not for lack of good faith and effort on the U.S. side, but because of a stubborn fact that we must finally recognize: (Russian President Vladimir) Putin wants to be our enemy.

"He will never be our partner … He believes that strengthening Russia means weakening America. We must proceed realistically on this basis."

Mattis said he supports engagement with Russia on areas of common ground, "but we also have to recognize reality ... we're going to have to confront Russia." That includes potentially using diplomatic, economic and military responses to keep the country in check.

But he would not support any specific sanctions against Russia, saying he needs to consult with the new national security team before making any decisions.

Democrats on the panel questioned Mattis’ past criticisms of opening up combat jobs to female troops and the repeal of the military’s "don’t ask, don’t tell" law, both points of pride for the outgoing administration of President Obama.

Mattis said he does not have any plans to repeal or walk back those policies "unless problems are brought to my attention." He dodged direct questions about whether those changes have made the military stronger, but did say that he is opposed to discrimination or ignoring the importance what women in the ranks mean to the all-volunteer force.

He also spoke of the importance of the "warrior ethos" of the military, in response to the importance of keeping battlefield readiness at the forefront of all planning decisions.

"The primitive and often primalistic aspects of the battlefield test the physical strength, the mental ability of everyone," he said. "But most of what it tests is the courage and the spiritual side of the troops, and often times it’s only unit cohesion, leadership and belief of their comrades that allows them to go through that and come home as men and women not broken.

"So that is essential."

The House and Senate are expected to vote in coming days on the waiver for Mattis, and most lawmakers have indicated they’ll back his appointment.

Leo Shane III covers Congress, Veterans Affairs and the White House for Military Times. He can be reached at lshane@militarytimes.com.