President Donald Trump issued a strong warning to Iran early Monday, saying it would face its "official end" if a war broke out between the two countries.

"Never again threaten the United States," Trump said in a tweet shortly after a rocket landed overnight near the U.S. Embassy in Baghdad.

Trump's comments came after he has seemingly sought to soften his tone on Iran in recent days following heightened tension sparked by a sudden deployment of U.S. bombers and an aircraft carrier to the Persian Gulf over unspecified threats.

GOP lawmaker on Iran threat: Directive was to 'kill and kidnap American soldiers'

Iraq's military said the Katyusha rocket that landed in Baghdad's heavily fortified Green Zone less than a mile from the U.S. Embassy, causing no injures, was believed to have been fired from east Baghdad. The area is home to Iran-backed Shiite militias.

On Monday evening, Trump said Iran has been "very hostile" but seemed to contradict his own advisers by playing down the threat of an Iranian attack on U.S. forces in the Middle East.

"We have no indication that anything’s happened or will happen, but if it does, it will be met, obviously with great force,” Trump told reporters as he left the White House for a campaign rally in Pennsylvania.

The Pentagon dispatched an aircraft carrier, B-52 bombers and other military resources to the Persian Gulf earlier this month to counter what top Trump administration officials said were alleged threats from Tehran. Officials said the U.S. had gathered credible intelligence suggesting a possible Iranian attack on U.S. troops on the ground and at sea.

Trump on Monday reiterated his willingness to sit down with Iranian leaders if they reach out to him.

"If they call, we would certainly negotiate. That’s going to be up to them," he said.

Congress is expected to get a classified briefing on Iran on Tuesday after Democratic and Republican lawmakers requested more information from the White House about the intelligence that has led to the growing U.S. military footprint in the gulf. The State Department ordered a partial evacuation of the U.S. Embassy in Baghdad last week.

In an interview with Fox News broadcast Sunday, Trump said he was not seeking a conflict with Iran but vowed not to let Iran develop nuclear weapons.

"I'm not somebody that wants to go into war, because war hurts economies, war kills people most importantly – by far most importantly," the president said.

Officials in Iran also have downplayed Tehran's appetite for war.

"There will not be a war since neither we want a war nor does anyone have the illusion they can confront Iran in the region," Iran's Foreign Minister Mohammad Javad Zarif told the Middle East country's state news agency Irna over the weekend.

Reacting Monday to Trump's new comments, Zarif tweeted: "Goaded by #B_Team, @realdonaldTrump hopes to achieve what Alexander, Genghis & other aggressors failed to do. Iranians have stood tall for millennia while aggressors all gone. #EconomicTerrorism & genocidal taunts won't 'end Iran.' #NeverThreatenAnIranian. Try respect – it works!" The "B Team" is a reference to Trump's National Security Adviser John Bolton, Israel Prime Minister Benjamin Netanyahu and Saudi Arabia's de facto leader Mohammad bin Salman. All three men have taken a hard line on Iran.

Tensions between Iran and the United States have escalated one year after Trump withdrew from the nuclear deal between Iran and world powers and reimposed sanctions that have severely harmed Iran's economy. Tehran has demanded that European signatories to the nuclear accord – France, Germany and the United Kingdom – find a way of keeping the agreement alive or it will again start enriching uranium at levels sufficient to pursue a nuclear weapons program.

Iranian state media reported Monday that the nation has quadrupled its production of low-enriched uranium amid tensions with the U.S. over the unraveling nuclear accord.

Trump says he doesn't want war: Is John Bolton driving the U.S. into a conflict?