DECORAH, Iowa — Hours after an American drone strike killed Iran’s top military commander, Joseph R. Biden Jr. stood in a barnlike building in Independence, Iowa, thundering about the importance of electing an experienced president as America faces tumult abroad — and “maybe, God forbid,” war.
About 70 miles away, Senator Bernie Sanders was just as passionate as he denounced military spending and encouraged international diplomacy.
“Maybe what we should be doing is figuring out how as a planet we work together instead of going to war with each other,” Mr. Sanders told the crowd on Friday inside a building on the Winneshiek County fairgrounds. Earlier in the day, he emphasized the need to “get our priorities right” by investing in issues at home rather than on military action abroad.
Amid signs that both Mr. Biden and Mr. Sanders have found their footing in Iowa after months of being overshadowed here, they are now aggressively seizing on the escalating tensions with Iran to press their starkly divergent cases for the presidency as they compete for an overlapping slice of the electorate.
Both men seemed newly energized on the campaign trail, treating the Iran confrontation as a clarifying political moment, as well as a tailor-made opportunity to showcase their long records on international affairs. And yet no two candidates better illustrate the sharp divisions in the party about what American leadership abroad should look like.
Mr. Biden, the former vice president, has focused on highlighting his decades-long résumé in foreign policy and his relationships overseas, casting himself as the candidate best prepared to assume the commander-in-chief title “on Day 1.”
In contrast, Mr. Sanders, Vermont’s junior senator, is emphasizing his long-held aversion to war while steadfastly promoting a domestic political agenda for America’s working class. “Joe Biden has prided himself on foreign policy experience for the last several decades,” said Sean Bagniewski, the Democratic chairman in Polk County. “I’ve heard Iowans say they think this election may focus more on foreign policy than many of us expected and that he’s now their guy.”
He added, “On the flip side, Bernie was one of the few Democrats to vote against the war in Iraq. I’ve heard folks say that reinforces their decision to support someone who they think had been right all along.”
The competition to gain the upper hand on national security played out in vivid relief on the campaign trail over the weekend, as tensions escalated between the two candidates over their judgment on matters of war and peace. Mr. Biden and Mr. Sanders both delivered forceful remarks in several of the same towns and cities in eastern Iowa, offering sharpened messages about America’s role in the world and their visions of presidential leadership.
In temperament, ideology and style on the campaign trail, the gregarious, gaffe-prone, relatively moderate Mr. Biden and the disciplined, democratic socialist Mr. Sanders could not be more different. Yet polling and interviews on the ground demonstrate that they have some overlapping appeal here, especially with the white, working-class voters who are skeptical of Senator Elizabeth Warren of Massachusetts and Pete Buttigieg, the former mayor of South Bend, Ind., the other two front-runners in Iowa who have done well with college-educated voters.
Less than one month before the caucuses, as Ms. Warren struggles to regain her momentum in the state, Mr. Biden is drawing notably more energized crowds — even if they are often smaller than those of his chief rivals — and attendees at his events frequently say that he makes them feel safe. Mr. Sanders, lifted by his loyal supporters, has displayed enduring political strength despite having a heart attack in October.
Mr. Biden and Mr. Sanders both appear to be “doing fairly well” in Dubuque, a heavily Catholic, blue-collar city along the Mississippi River where they campaigned this past week, said Steven Drahozal, the Democratic chairman of Dubuque County.
“This is the type of community, I think, that actually, interestingly, plays well to both of them,” Mr. Drahozal said. Mr. Biden, a Catholic, has longstanding relationships in the city, but Mr. Drahozal added that Dubuque also had a “very vocal, very active, very progressive community that is very supportive of Senator Sanders.”
Mr. Sanders views his consistent diplomacy-over-conflict stance — dating to his opposition to the Vietnam War and his anti-interventionist foreign policy as mayor of Burlington, Vt. — as an advantage with working-class Americans who are frustrated with the country’s involvement in costly and distant wars.
“I know that it is rarely the children of the billionaire class who face the agony of reckless foreign policy — it is the children of working families,” he said on Friday, reading from prepared remarks at an event in Anamosa.
Aides to Mr. Sanders view him as well positioned against Mr. Biden — who in many ways embodies the centrist Washington establishment Mr. Sanders dislikes — and they have urged him for months to go after the former vice president more directly. With foreign affairs, Mr. Sanders’s campaign sees an opportunity not just to call attention to the senator’s consistent resistance to war but also to draw an easy-to-grasp contrast between the two candidates.
Even before the airstrike in Iraq last week, Mr. Sanders’s aides had been eager to highlight his foreign policy views. But though he speaks on the trail about his opposition to America’s support for Saudi Arabia’s war in Yemen, foreign policy has so far taken a back seat in his campaign to domestic policy proposals like “Medicare for all” and tuition-free public college.
The rising tension with Iran, however, has afforded Mr. Sanders a fresh opportunity to highlight his diplomacy-centered vision for foreign policy — and in particular his opposition to the 2003 invasion of Iraq, a stance that underscores his contrast with Mr. Biden, who voted to authorize that war.
At an event in Dubuque on Saturday, Mr. Sanders called on Congress to “take immediate steps to restrain President Trump from plunging our nation into yet another endless war.”
His foreign policy views have struck a chord with voters in Iowa like Peggy Ross, 67, a bookseller from Decorah. “I think he has the right idea,” she said after seeing Mr. Sanders speak. “No one likes war.”
Yet Mr. Sanders’s dovish stances and his emphasis on domestic matters could also prove to be liabilities with voters who want a firmer response to foreign aggression than he appears to promote. They could also weaken his standing among Americans who are clamoring for an experienced hand in the international arena at a moment of global turmoil.
A CNN poll from late November found that 48 percent of Democrats and Democratic-leaning voters thought Mr. Biden was best equipped to handle foreign policy; Mr. Sanders was a distant second at 14 percent.
Mr. Biden, who chaired the Senate Foreign Relations Committee when he represented Delaware, is perhaps at his most fluent and comfortable when discussing international affairs, and he has made that issue a centerpiece of his message in a race that has been largely limited to domestic debates.
His campaign has run ads emphasizing his national security experience, and on Friday posted some of them on Twitter after news broke of the drone strike. On Sunday, the campaign announced endorsements from three Democratic members of Congress, all of whom are military veterans.
Mr. Biden’s allies say that renewed national focus on foreign policy allows him to strike a clear contrast with both Mr. Trump and his Democratic rivals, and injects fresh urgency into the question of who is the most electable candidate.
The gravity of the moment “propels deep interest among people in seeing the strongest candidate against Trump,” said Thomas E. Donilon, who was former President Barack Obama’s national security adviser and is supporting Mr. Biden.
And Mr. Biden, he said, was “a natural person to look to as a steady, experienced hand to deal with these issues on Day 1.” (Mr. Donilon’s brother, Mike Donilon, is Mr. Biden’s chief strategist.)
Throughout his latest Iowa bus tour, Mr. Biden frequently emphasized his relationships abroad and depth of experience as he warned against war in the Middle East. The next president, he said, will “inherit a country that is divided, and a world that’s in disarray.”
He added, “There can be no time for on-the-job training” — a message that could apply, he has suggested, to any of his leading rivals.
“With all due respect, I think I’m best prepared” on leadership matters compared to “anybody running,” Mr. Biden told an applauding crowd of about 700 on Saturday night in Des Moines.
It was not always a message delivered crisply, or accurately; on several occasions he suggested that Iran had a population of around 40 million people even though it is a nation of more than 80 million people. He also cited Saddam Hussein when he intended to refer to Osama bin Laden.
In Des Moines, when Mr. Biden was pressed by an attendee on his foreign policy record, he noted, as he often does, that he had quickly grown disillusioned with the Bush administration’s stewardship of Iraq and that he had become a vocal opponent of the war. He was also questioned on his view of the raid that killed bin Laden, the Al Qaeda leader; Mr. Biden’s answer on that issue has changed over the years.
“It’s not to suggest I haven’t made mistakes in my career, but I will put my record against anyone in public life in terms of foreign policy,” Mr. Biden said.
At weekend events for both Mr. Biden and Mr. Sanders, attendees viewed the unfolding developments in Iran with anxiety, if not grave apprehension.
“We don’t need to waste any more time,” said Korlu P. Jallah, 22, who attended an event for Mr. Biden in Waterloo on Saturday morning and said she was supporting him because of his experience. “We’re in a huge mess given the fact that we could possibly go to war with Iran.”
Still, she said, Mr. Sanders is her second choice.