On the Canadian government website, everything appeared to be normal with Saudi Arabia as of Tuesday morning. The two countries, the site stated, share “common interests on many peace and security issues.” Furthermore, Saudi Arabia constitutes “an important source of foreign students for Canada” and “trade and economic interests continue to be at the forefront of Canada’s bilateral relations with Saudi Arabia.”

The reality, however, is much different. After Canada’s foreign minister expressed alarm at the recent arrest of a Saudi women’s rights activist, the kingdom on Monday expelled the Canadian ambassador, halted trade and investment deals, and ordered up to 12,000 of its students to return to the kingdom. Flights will be suspended starting next week.

The measures were part of a seemingly unprecedented diplomatic storm that appeared to have come without warning, given that Canada is hardly the first Western democracy to criticize the monarchy’s human-rights record. But a closer look at Saudi Arabia’s responses to foreign criticism under its new crown prince, Mohammed bin Salman, tells a slightly different story: that Saudi fury didn’t come entirely out of nowhere.

“We have witnessed for some time now that Saudi foreign policy has become much more assertive and more muscular,” said Fawaz Gerges, professor of Middle Eastern Politics at the London School of Economics.

A number of European nations have felt the fallout of Saudi Arabia’s new assertiveness in recent years. In 2015, the kingdom temporarily recalled its ambassador to Sweden after the Scandinavian nation singled out Saudi writer Raif Badawi’s arrest and trial as an example of broader human rights failures in the Middle Eastern monarchy. (The activist at the center of the current Saudi-Canadian dispute is his sister, Samar Badawi, whose arrest was made public last week.)

And Germany has also felt the tougher approach Mohammed appears to have embraced. In November, its foreign minister, Sigmar Gabriel, said that Europe “could not tolerate the adventurism that has spread there.” The remarks were widely interpreted as criticism of Saudi Arabia’s military intervention in Yemen, which has cost tens of thousands of lives, as well as the strange trip by Lebanon’s prime minister to Saudi Arabia, where he publicly resigned — fueling speculation that he had been kidnapped.

Saudi Arabia first lashed out at Gabriel over what it said were “shameful and unjustified remarks,” and then recalled its ambassador, in the same pattern that played out in Sweden — with a twist. This spring, German officials confirmed to multiple media outlets that Saudi Arabia had also quietly blacklisted some German companies as a result of the criticism in a rare case of economic retaliation.

In Saudi Arabia, the recent criticism from Germany and Canada appears to have struck a nerve that goes beyond what sparked prior spats. Officials in Riyadh believe that they have already given enough to those demanding more liberties and tolerance, by allowing women to drive and pledging in October to return to a more “moderate Islam,” even as critics have raised doubts over the motives behind the changes. London School of Economics Middle East scholar Madawi al-Rasheed warned in October that measures such as the promotion of a “moderate Islam” were “geared to attract investors and create a feel good factor for a kingdom that had a very bad reputation.”

To revive his country’s weakening economy, the crown prince — who assumed power last year — has worked up plans to create a new, futuristic city in the west of Saudi Arabia that he hopes will attract tech companies.

To succeed, Mohammed will need to balance the interests of ultraconservatives in his kingdom and of liberals demanding more extensive changes.

“Arresting some female activists and liberal voices was probably his way of saying: I’m not just trying to crack down on ultraconservative voices, but also against those who don’t play along by rules of game: a gradual top-down reform process,” said Gerges, the Middle East scholar.

“Saudi Arabia’s foreign policy is an extension of that domestic balancing act. By confronting Canada, Saudi Arabia is sending the message anyone who interferes in Saudi’s internal affairs will face swift and prompt measures,” Gerges said. With the end of the Obama administration, one of Saudi Arabia’s toughest critics disappeared — putting other Western powers like Germany, France or Canada in a more awkward position.

By suspending at least some ties to nations like Canada and even more important trading partners such as Germany, Saudi Arabia now appears to be imitating an approach China has pursued with relative success in recent years: to modernize, but on its own terms.

And in Europe, the current consensus appears to be to play along — at least for now. Germany’s new foreign minister has so far refrained from the sort of blunt criticism his predecessor voiced, even though human rights remain on the agenda. Meanwhile, in neighboring France, President Emmanuel Macron said during a joint news conference with Mohammed in April that “if there is one chance that his project succeeds, then it’s the responsibility of France to accompany him,” referring to the Saudi reforms.

The most cutting official French criticism of Saudi Arabia’s human rights record during the crown prince’s visit was a rather oblique one: A tweet from Macron showed him with the crown prince discussing French painter Eugene Delacroix’s painting “Liberty Leading The People.” The painting shows a woman with bare breasts and on the revolutionary barricades.

There was no public complaint from Saudi Arabia over the tweet.