DES MOINES, Iowa — A whittled-down field of Democratic presidential candidates on Tuesday, Jan. 14, focused on their shared disdain for President Donald Trump and elaborated on a host of policy differences domestic and foreign in an Iowa presidential debate whose most animated moment turned on whether a woman could become president.

With the Democratic voting beginning in less than three weeks - and knotted among a quartet of leading contenders - the candidates differed over the suddenly topical decision of whether to commit troops abroad or remove them from the Middle East, their disparate views on trade deals and their starkly different proposals to remake the country's health-care industry.

Coming on the heels of President Trump's decision to kill Iranian Maj. Gen. Qasem Soleimani, the debate opened up with a relitigation of the war in Iraq, and a renewed discussion over how and whether the candidates would commit troops in the Middle East. Sen. Elizabeth Warren, D-Mass., committed to bringing combat troops home, while former South Bend, Ind., mayor Pete Buttigieg pointed to his own experience in the military. Former vice president Joe Biden cast his experience in that office as invaluable, while Sen. Bernie Sanders, I-Vt., suggested Biden's vote in favor of the Iraq War was disqualifying.

"Joe and I listened to what Dick Cheney and George Bush and [Donald] Rumsfeld had to say," Sanders said, speaking of the debate after the Sept. 11, 2001, attacks to give Bush authority to strike overseas. "I thought they were lying. I didn't believe them for a moment. I took to the floor. I did everything I could to prevent that war. Joe saw it differently."

Biden, while focusing on the work he did during the Obama administration to wind down U.S. military involvement in Iraq, did not defend the vote.

"It was a mistake to trust that they weren't going to go to war," Biden said about the Bush administration's assurances in 2002. "They said they were not going to go to war."

The candidates agreed on the need to reduce the U.S. military footprint in Iraq and Afghanistan, though they differed slightly on timetables and other details.

"No one has a solution and an endpoint. We need to get our combat troops out," Warren said. "They are not helping."

Biden and others struck a more nuanced note, arguing that Special Operations forces should remain in the region to guard against a resurgence of the Islamic State and to protect U.S. interests.

The former vice president also said he would not meet with North Korean leader Kim Jong Un, with whom Trump met, to much-orchestrated drama but with whom he has been unable to strike a deal on nuclear weapons.

RELATED: Commentary: Winners and losers from the Iowa Democratic debate

"No. Not now. I wouldn't meet with him without preconditions," he said, blaming Trump for giving the North Korean legitimacy by meeting with him.

He also noted that the leader had called him "a rabid dog who should be beaten to death with a stick."

"Other than that, you like him," Sanders joked.

Gender politics, which subsumed the campaign in recent days, provided one of the sharpest exchanges of the night as Warren and Sanders clashed over whether Sanders said in a private 2018 meeting that a woman could not be elected against Trump in 2020.

Sanders denied the claim outright. "Does anybody in their right mind believe that a woman can't be president?" Sanders said. "I don't think anybody believes that."

But Warren, as part of an apparent pivot to embrace her role as the highest-polling woman in the race, stuck to the claim she first made the day before the debate.

"I disagreed," she said of her conversation with Sanders in 2018. "Bernie is my friend, and I am not here to try to fight with Bernie. But look, this question about whether or not a woman can be president has been raised and it's time for us to attack it head-on."

She went on to divide the stage by gender, saying that she and Sen. Amy Klobuchar, D-Minn., were the only two candidates to have won all of their elections, while the men onstage had collectively lost 10 races.

Klobuchar laughingly agreed, and later noted that she had an unbroken record of winning in areas similar to those in which Trump had defeated Clinton.

As the debate ended, Warren could be seen approaching Sanders but declining his offer of a handshake. They both appeared to be testy, Warren wringing her hands and Sanders making frequent gestures.

The extended confrontation was remarkable, coming four years after the party selected Hillary Clinton as its first female nominee. Her loss to President Trump amid what many felt were misogynistic attacks helped energize women who came out for massive marches the day after he was elected, helped fuel the election of record numbers of women to Congress and handed the House speaker's gavel back to Nancy Pelosi.

But Democratic anxiety over Trump, and whether he could defeat another woman, has been one of the looming questions over the primary for the past year, asked everywhere from top party leaders to Democrats attending rallies in early states.

Biden chimed into the discussion to argue that he alone had the longevity and the experience to knit together a coalition of the whole party.

"I agree women can win," Biden said, touting the number of female candidates he helped in 2018 and calling it "the best group I've ever campaigned for in terms of competence."

"But the real issue is who can bring the whole party together represents all elements of the party," he said. "I would argue that in terms of endorsements around the country, endorsements, wherever we go, I am the one who has the broadest coalition of anyone running up here in this race."

The debate came just 20 days before the Iowa caucuses, the results of which are likely to be pivotal in the 2020 nomination fight. The major Democratic candidates have gone all-in on the state, and with polls showing a multicandidate tie, with about 1 in 5 voters favoring Biden, Sanders and Buttigieg. Warren is close on their heels with 16 percent support, according to an average of two Iowa polls over the past week.

The two other candidates on the stage, Klobuchar and the billionaire activist Tom Steyer, have been ranking in the single digits, well below the 15 percent threshold required by party rules to acquire convention delegates.

Steyer, who has gained ground in several new polls after a barrage of television ads, made one of his most aggressive arguments around the need to combat climate change.

"We're going to come to the rescue of Americans who are in trouble. But this is why climate is my number one priority," he said. "And I'm still shocked that I'm the only person on this stage who will say this: I would declare a state of emergency on day one."

For several of the candidates onstage, the debate marked the final highlighted moment before the Senate impeachment trial diverts the nation's attention and demands their presence in Washington. While Warren, Sanders and Klobuchar will have to serve as jurors, Biden too could be roped into the proceedings; some Senate Republicans are seeking to force his son Hunter to testify about his activities in Ukraine when his father was vice president.

Biden said Tuesday night that he had no concern about his family being dragged into the Senate trail. There has been no evidence of wrongdoing on the part of either Biden, but it has been a topic the campaign has generally tried to avoid.

"It doesn't really matter whether he goes after me," Biden said. "I have got to be able not only to fight but also to heal, and as president of the United States that's what I will attempt to do."

Some of the debate reprised earlier such gatherings. For the seventh straight faceoff, the candidates cast different visions on health care, with Sanders continuing to push for Medicare-for-all, which would abolish the private health care industry.

"Again, I think it is much better to build on the Affordable Care Act," Klobuchar said. "And if you want to be practical and progressive at the same time and have a plan and not a pipe dream, you have to show how are you going to pay for it."

Several of the candidates tried to address some of their shortcomings.

Buttigieg responded to concerns in the party, shown in a recent Washington Post poll, that black voters do not support his campaign, even after they learn more about him.

"The black voters who know me best are supporting me," Buttigieg said, before listing off several recent endorsements. "The biggest mistake we can make is to take black votes for granted. And I never will."

In the opening minutes of the debate, Sanders also tried to address the concerns that he is too divisive and wouldn't have enough appeal to a general electorate.

"I am able to work with Republicans," he said, citing unsuccessful legislation he co-sponsored with Sen. Mike Lee, R-Utah. "I am able to bring people together to try to create a world where we solve conflicts over the negotiating table, not through military efforts."

This article was written by Matt Viser, Michael Scherer and Annie Linskey, reporters for The Washington Post.