Iran’s top leader struck a belligerent tone Tuesday in an escalating confrontation with the West, promising further Iranian violations of the fraying nuclear agreement and retaliation for what he called the piracy of an Iranian tanker by “the vicious British.”

The defiance expressed by the top leader, Ayatollah Ali Khamenei, contrasted with what seemed like a less confrontational stance taken at the White House. President Trump told reporters that “we’re not looking for regime change” in Iran and that Iranian leaders had communicated a desire for negotiations with the United States despite their hostile remarks in public.

“They’d like to talk, and we’ll see what happens,” Mr. Trump said. Mike Pompeo, Mr. Trump’s secretary of state, asserted that Iran was willing to negotiate over its missile program, an area of Western concern that was not covered in the 2015 nuclear agreement.

Just a few weeks ago the Trump administration, which abandoned the nuclear agreement last year, was on the verge of ordering a military strike on Iran over its downing of an American surveillance drone.