The Trump administration will certify that Iran is in compliance with the nuclear agreement signed two years ago in Vienna, according to administration officials, but insisted that Tehran will face consequences for breaching “the spirit” of the deal.

President Trump, who lambasted the 2015 pact as a candidate, gave himself more time to decide whether to scuttle the agreement or let it stand. Senior administration officials, instead, sought to emphasize their concerns about Iran's non-nuclear behavior and vowed that those transgressions won't go unpunished.

In a shift from Trump's previous threat to "rip up" the deal, officials said the administration was working with U.S. allies to try to fix the deal's flaws, including the expiration of some nuclear restrictions after a decade or more. The officials also said the U.S. would slap Tehran with new sanctions penalizing it for developing ballistic missiles and other activity.

Senior administration officials say they will, in coordination with European allies, push for stronger interpretation and enforcement of the nuclear agreement and enact more sanctions in response to Iran's ballistic missile program.

Trump called the nuclear agreement "the worst deal ever" during the 2016 campaign, but his administration has now certified Iran's compliance twice.

The officials say the U.S. is not pursuing regime change in Iran, but wants to stop its aggressive behavior.

In its condemnation of Iran, senior officials emphasized several longstanding U.S. concerns about Iran's ballistic missile programs, human rights abuses and support for terrorism in the region. They also criticized Iran for detaining U.S. citizens and limiting freedom of navigation in the Persian Gulf.

“US is certifying that conditions laid out have been met based on info avail to us as of today,” a senior official said to Fox News on Monday. “However, The Secretary of State and the President intend to emphasize that Iran remains one of the most dangerous threats to regional stability.”

The late-night announcement capped a day of frenzied, last-minute decision-making by the president, exposing deep divisions within his administration in handling a top national security issue.

Since early last week, Trump's administration had been prepared to make the certification, a quarterly requirement. Trump first told Congress in April that Iran was indeed complying, but with no final decision on his broader Iran policy, the White House had planned to let it stand for another three months.

When Trump made his first certification, he paired it with new sanctions for non-nuclear behavior to show there was no softening of his stance toward the Islamic Republic.

The deal was first enacted in 2015, Iran agreed to roll back its nuclear program, long suspected of being aimed at developing atomic weapons, in return for billions of dollars in sanctions relief.

The deal does not address global concerns about Iran's non-nuclear activities, but also doesn't prevent the U.S. and others from punishing Iran for those activities. Iran remains on the State Department's list of state sponsors of terrorism for its support of anti-Israel groups.

Scuttling the deal would put further distance between Trump and foreign leaders who are already upset over his move to withdraw the U.S. from the Paris global climate change accord.

The Associated Press contributed to this report