President Donald Trump’s offer Monday to meet with Iranian President Hassan Rouhani caught senior administration officials as well as U.S. allies off guard. Many wondered what Trump could possibly be thinking.

Trump’s offer needs to be seen in the context of events in Iran. Iran is in the throes of rapidly growing, country-wide protests which may be the largest it has seen since the 1979 revolution. And worse is yet to come.

Beginning next week, U.S. will begin reimposing sanctions suspended by the Obama administration. Iran’s economy, already in a tailspin, stands a good chance of collapsing.

Trump made his offer in the context of an overall U.S. policy towards the Iranian regime. That policy was set out explicitly by Secretary of State Mike Pompeo in a speech in May and in another last month.

In May, Pompeo told an audience at the Heritage Institute that the U.S. sanctions against Iran would remain in place until the regime abided by twelve U.S. demands. The major demands require Iran to end all of its nuclear activities and come clean about its past nuclear operations; end its sponsorship of terrorism regionally and worldwide; respect the human and civil rights of the Iranian people; and end the aggression it is carrying out against its neighbors both directly and through its terror proxies.

In July, Pompeo spoke explicitly in favor of the Iranian people now protesting against the regime. He signaled clearly that the U.S. supports efforts by the Iranian people to overthrow the regime in Tehran.

So when Trump offered to meet with Rouhani without preconditions, it did not mean that he does not expect Iran to change its behavior. It meant that he was willing to meet with Rouhani while leading a policy whose goal is the fundamental transformation of Iran (to borrow a phrase from Barack Obama).

Trump would be happy if that transformation comes in the framework of a massive change in regime behavior. He would also be happy if it comes through a revolution that overthrows the regime.

As for the Iranians, their behavior in recent days probably gave Trump reason to believe they may be desperate enough to at least consider the former option.

On Sunday, Iran’s Supreme National Security Council reportedly decided to free the country’s two top political prisoners from house arrest.

Hossein Karroubi, the son of Mehdi Karroubi, told the Kalameh website in Iran that the council had decided to free his father and Mir Hossain Mousavi from house arrest. The two have been confined to their homes since 2009, when they led the Green Revolution in the wake of Iran’s 2009 presidential elections. The two men each won far more votes than the incumbent president, Mahmoud Ahmadinejad. But in a mark of the regime’s contempt for the public, and for the very concept of democracy, Ahmadinejad was declared the winner. The mass countrywide protests that followed the stolen election represented the gravest threat the regime faced since the 1979 revolution.

To save itself, the regime sent its Basij paramilitary forces into the crowds of hundreds of thousands of protesters that gathered throughout the country demanding its overthrow. The Basij forces brutally repressed the protesters. Mousavi, his wife, and Karroubi were confined to their homes. Then President Obama, who was keen to reach an accord with the regime, refused to back the protesters.

The regime’s decision to free its top political prisoners is not a sign that it is willing to admit its crimes or make amends to the Iranian public. It is a sign of desperation.

With each passing day, the size of the crowds in the streets protesting against the regime, and the number of cities in Iran that are experiencing major protests, grows. The slogans they shout are not limited to demands that the regime bear down on corrupt officials and lower inflation. Protesters are calling for the overthrow of the regime.

Throughout the country, protesters are calling out, “Death to the Dictator,” meaning “supreme leader” Ali Khamenei. In Isfahan on Tuesday, protesters shouted out, “Reza Shah, may your soul and spirit be happy!”

Reza Shah was the founder of the dynasty that was overturned in the 1979 Islamic revolution. It is also the name of the Shah’s son in exile.

Protesters also insisted that they are done with the regime as a whole. They called for the death of both “reformists,” and “hardliners.”

As for Mousavi and Karroubi’s announced release, although the movement they led in the wake of the 2009 presidential election morphed into an attempted revolution that was brutally suppressed, Mousavi and Karroubi are not revolutionaries themselves. They are reformists deeply embedded in the regime.

In the 1980s, Moussavi served as prime minister and foreign minister, and Karroubi served as speaker of the parliament.

Khamenei and his advisors no doubt view the two men as a bridge to the protesters in the streets, who can moderate their demands and so stabilize the regime. But the fact that the protesters are now insisting there is no distinction between reformers like Mousavi and Karroubi and hardliners like Iranian Revolutionary Guards Corps Al Quds Force commander Qassem Suleimani indicates that the regime may be a day late and a dollar short.

It isn’t just that the protesters want revolution and not reform. They also want America. They hate the regime more than they hate the United States.

In Karaj, outside Tehran, anti-regime protesters were filmed shouting, “Our enemy is here, they are lying when they say it is America.”

Under the circumstances, attempts by regime officials to blame Iran’s economic problems on the U.S. are doomed. After failing to convince the Europeans to bypass U.S. sanctions, the only way the regime can save even a semblance of a normal economy is to beat a path to Washington.

And so, over the past week, Suleimani and Foreign Minister Javad Zarif beat a path to Muscat, Oman, in the hopes of working something out. Muscat served as a mediator between the Tehran regime and the Obama administration in the early stages of their contacts, so it was a natural place for the Iranians to turn to renew contacts with Washington today.

Immediately after his meetings with Zarif and Suleimani, Oman’s Foreign Minister Yusuf bin Alawi bin Abdullah flew to Washington for meetings with Secretary of State Mike Pompeo and Secretary of Defense James Mattis.

The Iranians deny that they are using Oman as a mediator. But the confluence of meetings makes it difficult to accept their claims. It is all the more difficult to take their position seriously when Trump made his offer to meet with Rouhani during bin Abdullah’s visit to Washington.

This, then brings us to the purpose of Trump’s offer, and what it tells us about Trump’s view of how to achieve the American goal of fundamentally transforming the regime — either by coercing it to abide by Pompeo’s twelve conditions or by supporting a popular revolution.

Only time will tell if Zarif’s and Suleimani’s attempts to open channels of communication with Washington signalled regime willingness to consider such a transformation. The fact that Pompeo repeated the U.S. position on CNBC after Trump made his offer for talks suggests that the administration thus far has not been lured by the regime into changing its policy.

Although the media portrayed Pompeo’s statement as contradicting Trump’s assertion that there are no preconditions for negotiations, Pompeo simply restated the administration’s position when he told CNBC that the Iranians need to accept the basic parameters of the U.S. position set out in his speech at the Heritage Institute as a basis for negotiations.

One of the things that distinguishes Trump from Obama, as well as from George W. Bush and Bill Clinton, is how he views negotiations. When his predecessors sought diplomatic channels with Iran and North Korea, they willingly discarded all the other levers of statecraft, including military and economic pressure.

The Bush administration took North Korea off the State Department list of state sponsors of terrorism and withdrew economic sanctions on Pyongyang. Clinton provided North Korea with fuel and food. The Bush administration downplayed Iran’s role in fomenting and maintaining the insurgency against U.S. forces in Iran and Afghanistan, and Iran’s role in the September 11 attacks. And Obama gave Iran an open road to regional hegemony in the Middle East through a host of economic, military, and political concessions at the expense of U.S. allies and interests throughout the Middle East.

Trump, in contrast, uses diplomacy in tandem with economic and military pressure to foment a change in behavior in his opponents. As Breitbart News’ Joel Pollak explained, the difference between Trump’s offer to negotiate with the Iranians and Obama’s offer to negotiate with them is that Trump’s offer was made from a position of strength while Obama’s offer was made from a position of weakness.

If Trump senses that the Iranians are willing to make a deal along the lines set out by Pompeo — that is, if the regime is willing to agree to curtail its sponsorship of terror and mayhem and end its nuclear program without war — he would be a fool not to pursue it. Assuming he handles them properly, if the talks fail, the Iranian public will be more than willing to blame the regime.

That said, there are two major risks to holding negotiations. First, the Iranian people may view such negotiations as a signal that the U.S. will sell them out. To mitigate that risk, it is imperative that any talks be conducted publicly. The regime will use secret channels as a means to signal that like the Obama administration, the Trump White House supports it against the Iranian public.

The second risk is not unique to discussions with Iran, but is a risk in all negotiations between Western democracies and authoritarian tyrannies.

All negotiations have a tendency to create a dynamic in which reaching a deal – any deal – becomes more important than achieving the goals that brought the parties to the negotiating table in the first place. Western leaders, who are subject to media scrutiny and election pressures, are more susceptible to the pressure to achieve a deal than leaders of dictatorial regimes like those in Iran and North Korea.

As a consequence, the dynamic of negotiations works against the interests of the Western powers and favors the interests of the authoritarians they face at the table. In the current context of U.S.-Iranian relations, we will know that we should be concerned about this dynamic if and when the administration diminishes its public support for the anti-regime protesters in Iran.

On Wednesday, U.S. Central Command warned that Iran is about to launch a massive military exercise in the Straits of Hormuz. Suleimani and other regime leaders have threatened repeatedly in recent weeks to seal the maritime choke point through which 20 percent of world oil shipments transit if the U.S. blocks Iranian oil exports.

This Iranian move, like the missiles its Houthi proxies shot at two Saudi oil tankers in the Bab el Mandab choke point in the Red Sea least week, shows that the Iranians also know how to talk and shoot at the same time.

Obviously, it is too early to know where Trump’s offer will lead. But what is clear enough is that Trump’s offer to negotiate with Iran is no fluke. It is a shrewd, albeit high-risk move made in a complex and highly dynamic and dangerous standoff between the U.S. and its allies — and a lethal, menacing regime whose back is up against the wall.

Caroline Glick is a world-renowned journalist and commentator on the Middle East and U.S. foreign policy, and the author of The Israeli Solution: A One-State Plan for Peace in the Middle East. Read more at www.CarolineGlick.com.