President Hassan Rouhani of Iran, visiting the United States for the first time since President Trump exited the 2015 Iran nuclear accord, said Monday that the only way his country would consider new talks with Washington is for Mr. Trump to reverse himself and honor the agreement.

Speaking to a group of two dozen academics, former government officials and journalists, Mr. Rouhani argued that going back “six months ago is much easier than going back six years,” when the first efforts to negotiate an agreement were broached.

While he declared that Mr. Trump’s strategy of trying to crush the Iranian economy with sanctions would fail, he expressed no anger and portrayed his government as the one that was abiding by international agreements that the United States had tossed aside.

But when pressed on how long Iran planned to play a military role in Syria, Mr. Rouhani was unrelenting. “We will be in Syria until terrorism is completely eradicated,” he said, and as long as Iran remained invited there by the Syrian government.