Iran is being "extremely cautious" following President Donald Trump's decision to pull out of the 2015 nuclear deal, former Israeli Prime Minister Ehud Barak told CNBC on Friday.

With two newly installed hardliners — Secretary of State Mike Pompeo and National Security Advisor John Bolton — driving Trump's foreign policy, Iran worries that the United States may be looking for an excuse to strike militarily, Barak said on "Squawk Box."

"The Iranians, I should tell you, are suspicious that with Pompeo on one side and Bolton on the other side, the next step, they suspect, might be a cautious waiting for the slightest mistake ... that will lead to [an] American strike on their nuclear assets," said Barak.

He stopped short of criticizing Trump's move this week to exit the multination Iran deal, President Barack Obama's signature foreign policy achievement. While agreeing it was a bad agreement, the former Israeli prime minister did say he thought there were other ways to deal with Iran's destabilizing behavior.

After Trump announced his decision on Tuesday, Iran launched a rocket attack from Syria on Israeli positions in the Golan Heights. Israel responded with warplanes hitting Iranian targets in Syria.

The agreement to curb Iran's nuclear program in exchange for lifting economic sanctions also involved the U.K., France, Germany, China and Russia.

"Once the president pulled out, it's a fact," Barak said. "It doesn't cancel the deal because the others are not going to pull out."

Despite the complications Trump created with international partners on Iran, the U.S. president did put Tehran on notice, Barak said.

"It created new realities. The Iranians are extremely cautious. And in the same way, you can look at North Korea," he said. "One of the reasons the North Koreans get warmer with South Korea has to do with the fact that the American president now is totally unpredictable in the minds of these players."

Barak was prime minister from 1999 to 2001 as leader of Israel's Labor Party. He also served as defense minister from 2009 to 2013 in a coalition government with Prime Minister Benjamin Netanyahu, who long lobbied for scrapping the Iran nuclear deal.