Saudi Arabia's King Salman and U.S. President Donald Trump just agreed to keep the Iran nuclear deal.

The two heads of state spoke on the phone, agreeing to "rigorously" enforce terms of the existing deal, according to a Sunday statement from the White House reported by AFP.

Trump and Salman "agreed on the importance of rigorously enforcing the Joint Comprehensive Plan of Action with Iran [aka the Iran nuclear deal] and of addressing Iran's destabilizing regional activities," the statement said.

A statement from the Saudi press agency didn't specifically mention the Iran deal but said both leaders' views "were identical" on issues discussed during the call.

Trump previously said he would tear up the deal

Throughout his presidential campaign, Trump was a vocal critic of the landmark nuclear deal, seen as a key achievement of his predecessor Barack Obama. The deal, which was made through the joint efforts of numerous world powers, aims to limit Iran's nuclear capabilities in exchange for lifting international economic sanctions against the country.

Trump previously called the agreement "the worst deal ever negotiated." He said it would be a top priority to dismantle it once he took office. 

Saudi Arabia views Iran as its main geopolitical rival and voiced strong concerns when the deal was initially made. But Adel Al Jubeir, the kingdom's foreign minister, expressed optimism about Trump's Iran positions earlier this month. 

Jubeir said Riyadh's views on regional issues "align" with those of the new American president, specifically pointing to Iran saying: "Wanting to contain Iran ... absolutely."

Trump's Muslim ban targets Iran

Even if Trump plans to keep the Iran nuclear deal as is, he has taken a hardline stance against the country. 

His infamous executive order banning immigration from Muslim majority countries includes Iran, as well as six other countries. Iran retaliated banning all Americans.

Iran's foreign ministry called Trump's ban an "insult to the Islamic world."  

The ministry said Iran "will take reciprocal measures in order to safeguard the rights of its citizens until the time of the removal of the insulting restrictions of the government of the United States against Iranian nationals."

Iran's president previously said Iran would not allow Trump to "rip up" the nuclear agreement.

"Do you think the United States can rip up the JCPOA (the Joint Comprehensive Plan of Action nuclear deal)? Do you think we and our nation will let him do that?" President Hassan Rouhani said.