NEW YORK — The election was always going to be about Donald Trump.

But over the span of a few days, the yearslong focus on the Republican president’s performance on the economy, health care and immigration has been overtaken by an urgent debate over foreign policy and war. And as the sprint to Iowa’s Feb. 3 caucuses begins, both Trump and his Democratic rivals are being forced to navigate a delicate and dangerous military conflict with Iran that injects a new level of uncertainty into the 2020 contest.

For Democrats, the politics of war now could play a major role in shaping how voters view the winnowing field. And for Trump, who relentlessly cheerleads the American economy, it marked a departure from the standard fare of his rallies and tweets and became the most dangerous moment of his 3-year-old presidency.

In a carefully scripted speech, the brash president met the moment with a rare dose of restraint. Less than 24 hours after missiles from Iran rained down on military bases housing U.S. troops in Iraq, he downplayed the impact of the attack.

“The United States is ready to embrace peace with all who seek it,” a solemn Trump declared.

The measured approach reflects the political sensitivity of a situation that Trump helped create by ordering the killing of Iran’s top general late last week.

The Republican president is leading a political party openly feuding with itself over America’s role in global affairs. One faction is cheering his “America First” campaign promises to stop “endless wars.” Another wants Iran to pay a painful price for an attack that violated the clear red line Trump outlined in a social media post days earlier.

For a day at least, Trump appeared to placate both factions with a speech that toed the line between humility and strength.

Fox News host Sean Hannity, who appeared to be cheering for a fierce U.S. counterattack before Trump’s speech, was unusually silent in the hours afterward. Sen. Rand Paul, perhaps the Senate GOP’s most fervent isolationist, tweeted that he was “pleased that President Trump has pulled back and taken the preferred path of no further military action.”

This phase of the conflict has only just begun, however.

The president’s actions in the coming days and weeks will mean far more than the scripted words in one speech. Trump, of course, has struggled with discipline and consistency throughout his presidency — especially on social media.

One misplaced tweet or off-handed comment at a political rally could shatter the fragile peace. He is scheduled to face thousands of his supporters Thursday night in Ohio, where his thoughts on Iran almost certainly won’t be as scripted.

READ MORE: Iran sends mixed signals as tensions with the U.S. ease

“Trump’s not out of the woods,” said Republican pollster Frank Luntz, who predicted that remnants of the military conflict would help shape the 2020 election even if no further military action takes place.

Indeed, even if the infighting within his party dies down, Trump will face legitimate questions in the months ahead about his muddled foreign policy, which has scrambled alliances across the globe and emboldened some of America’s most dangerous adversaries, including Russia and North Korea.

After maligning NATO for much of his presidency, Trump on Wednesday called for the alliance of Western nations to take a greater role in the Middle East. And he falsely blamed the Obama administration for providing funding for the Iranian missile attack, ignoring his own 2018 decision to abandon the international agreement to prevent Iran from acquiring a nuclear weapon.

During a campaign appearance in Chicago, Democratic White House hopeful Michael Bloomberg urged Trump not to act “rashly or recklessly.”

The prospect of a wartime election may be new in 2020, but the shift would mark a return to normalcy of sorts in presidential politics, at least in this century. International affairs and military conflict have played a central role in almost every presidential contest since 2000.

The 2004 contest came just a year after President George W. Bush ordered the invasion of Iraq. Obama beat Republican war hero John McCain in a 2008 election shaped by voter fatigue over the wars in Iraq and Afghanistan. And in 2016, Trump effectively turned the tables by casting Democrat Hillary Clinton as an establishment-minded globalist who would pursue endless wars.

No one stands to gain — or lose — more in a foreign policy election than former Vice President Joe Biden.

While Trump sought to de-escalate on Wednesday, Democratic candidates sorted through what the conflict means for them. No one stands to gain — or lose — more in a foreign policy election than former Vice President Joe Biden.

“Biden just won the nomination,” South Carolina-based Democratic strategist Boyd Brown, a Biden supporter, said as the first news reports revealed the extent of the Iranian missile attacks.

While Brown is far from objective, variations of his idea rippled through the political stratosphere as Democratic voters paused to rethink the terms of a 2020 nomination fight through the lens of war. The party’s far-left wing, in particular, was forced to face the fact that the overwhelming strength of their preferred candidates, Bernie Sanders and Elizabeth Warren, lies in their grasp of domestic priorities like health care and income inequality, not international affairs.

For all his experience on the world stage, however, Biden has yet to put to rest stubborn questions about his 2003 vote as a Delaware senator to authorize military force against Iraq. It was that vote, followed by Bush’s invasion, that triggered nearly two decades of military conflict that shapes conditions in Middle East today.

But despite any questions Democrats will face, do not expect Trump to cede his leading role in the 2020 drama anytime soon.

As the world waits to see whether the peace with Iran will last, Trump’s impeachment trial in the Senate is just days away.