WASHINGTON — John R. Bolton, the national security adviser, said on Sunday that European officials should have known that President Trump would withdraw from the Iran nuclear deal, despite months of negotiations to salvage the accord that they believed had brought them close to satisfying the president’s demands.

“Despite the complete consistency of President Trump in his opposition to the deal — opposed to it as candidate Trump, opposed to it as President-elect Trump, opposed to it as President Trump — many people, including apparently former Secretary of State John Kerry, thought that we never would get out of it,” Mr. Bolton said on CNN’s “State of the Union.” “Now, I don’t know how to explain why people could miss what the president was saying. So, I think, at the moment, there’s some feeling in Europe that they’re really surprised we got out of it, really surprised at the reimposition of strict sanctions.”

“I think that will sink in, and we’ll see what happens then,” he said.

Mr. Bolton’s remarks could further exasperate the Europeans, who expressed disappointment when Mr. Trump abandoned the deal last week. They had dedicated top diplomats to the negotiations and believed that they had nearly worked out the specific fixes Mr. Trump had insisted on in a speech in January to remain in the agreement.

As recently as May 4, Secretary of State Mike Pompeo had told his European counterparts that if he could win a few more days for negotiations, he believed that there was a chance that the two sides could come to an agreement on the last sticking point. In his confirmation hearings, Mr. Pompeo had said he supported a fix.