Sophisticated foreign policy establishments have a purpose. To minimize unforeseen consequences of policies emanating from political leadership, policy experts “game” the implications of policy shifts — an analytic exercise involving the imagining of low-probability scenarios that could potentially produce dangerous outcomes.

With a fully staffed foreign policy team still in formation, here we do the stuff of policy analytics, mapping out “nightmare” scenarios that are hypothetical consequences of two of President Trump’s foreign policy orientations: 1) deriding Mexico as an exporter of riffraff and as a country subsidized by NAFTA-protected consumer goods, and 2) recognition of Russia as a valued international partner, especially in the war on terrorism.

In each of our nightmare scenarios, we consider how Russian President Vladimir Putin might take advantage of events in other countries to undermine the cornerstone alliance of U.S. international security: NATO, the North American Treaty Organization.

We assume that Putin dreams of a reconstituted great power with a sphere of influence among the former Soviet states and allies. Putin has long opposed NATO’s expansion into Russia’s back yard, explicitly affirming that “the expansion of military alliances” threatens Russia’s borders. In Putin’s view, NATO’s inclusion of former Soviet bloc nations such as Poland, Hungary, Bulgaria and the Czech Republic — as well as former Soviet republics such as Estonia, Latvia and Lithuania — challenges Russia’s interests.

Donald Trump’s orientation toward Mexico and NATO brings several realistic opportunities for Putin to pursue his goal of neutralizing the perceived threat of an expanding West and regaining Soviet glory. Such opportunities for Russia, however, are threats to U.S. interests. Rather than leave these potential threats abstract, we’ve mapped out two resulting scenarios, which need to be considered as the costs and benefits of turning orientations into policy are calculated.

Nightmare Scenario #1: Neutering NATO with a new Cuban-style missile crisis

In this scenario, the struggling Mexican economy sets the stage for anti-U.S. sentiment among the Mexican electorate, and carries the left to victory in Mexico’s 2018 elections. The election of Trump brought the Mexican economy into crisis, with a sharp drop in the peso after the U.S. election. Mexico’s economic woes further hurt the chances of the unpopular party in power (the PRI) maintaining the presidency.

Enter Putin.

In November, Putin signed a security agreement with President Daniel Ortega of Nicaragua — an old Soviet ally during the Cold War. Back in the 1980s, the Reagan administration was concerned that such an alliance might lead to other alliances to the north, including Mexico. The great fear was that the Soviet Union could claim a presence on the U.S. border.

It’s not obvious which of the remaining parties will win Mexico’s 2018 presidential race — right-wing PAN, left-wing PRD or the new left-wing MORENA party. A PRD victory could open the door for Mexico to enter into a security agreement with Russia, similar to the one Putin recently signed with Nicaragua.

Andrés Manuel López Obrador, who formerly ran for president for the PRD and now leads MORENA, announced in the 2012 presidential race that he would reject U.S. intelligence, arms and money to deal with drug trafficking. On Feb. 12 of this year, López Obrador blasted Trump’s immigration policies and the proposed wall along the U.S.-Mexico border, calling for a formal complaint to the United Nations of human rights violations.

Given the anti-Mexican rhetoric coming from Washington, it’s not a wide stretch to imagine López Obrador or a similar candidate seeking to fill the gap of lost U.S. aid with aid from Russia. This aid would only heighten tensions between Mexico and the United States, which could lead Mexico to consider a security agreement with Russia.

A security pact with Mexico would give Putin considerable leverage over U.S. NATO policy. Putin could promise to match in Mexico any defensive missiles that NATO has in place in former Warsaw Pact countries.

A Russian-Mexican defensive pact could essentially neuter any plans for U.S. defensive missiles in the NATO countries of Eastern Europe. A weakened NATO could set the stage for more aggressive actions by Russia toward its neighbors. But there’s a bigger nightmare. Russian implementation of such a pact could line up another direct nuclear confrontation — like those tense 13 days in October 1962.

Nightmare Scenario #2: Testing NATO Resolve

The key to the NATO agreement is Article 5, the principle of collective defense. An attack against one NATO ally is considered an attack against all allies. NATO exercises planned during the Obama administration are taking place at the Estonian/Russian border to demonstrate NATO solidarity. But Trump, in his public remarks, has made the commitment to collective defense ambiguous. Might Putin take this ambiguity as an invitation to test NATO’s resolve?

Here’s how this scenario plays out. Along lines suggested by journalist Uri Friedman in his interview with former NATO officer Richard Shirreff, suppose Putin sends out another handful of “little green men” — the nickname for the Russians deployed to Ukraine in 2014. This time, they head across the Narva River in the west of St. Petersburg oblast, into the town of Narva.

The majority of the population in this northeastern-most Estonian town is of Russian origin. They have integrated well into Estonian society and nearly all secondary students there are now studying in Estonian, a language in which their parents (born in Soviet Estonia) were mute.

Indeed, surveys reveal that local Russians largely disagree with Russian troops going into Estonia for the “protection of their compatriots.” Nonetheless, due to historical, geographical, media and linguistic connections, these Russian-Estonians have latent sympathies with the Russian Federation.

Suppose Putin’s little green men create violent incidents in confrontations with the 5 percent of Narva’s population that has Estonian cultural roots. Suppose further (perhaps due to the instructions provided to Putin’s undercover agents) several young Russian Estonians are killed.

Would that justify Putin’s use of the language of the U.N.’s Responsibility to Protect principles to send his regular troops into a NATO country to “protect” the Russian-Estonians from further violence? Would the local population stand firm as Estonians?

More important, would NATO respond in full force in a land war against Russia to protect Estonia’s territorial sovereignty? If not, well, NATO would essentially be obsolete, and NATO’s collective security commitment would fall into desuetude. This would be a historic victory for Putin.

These two scenarios map out the ways in which Trump’s anti-Mexican and anti-NATO statements have opened new potential avenues for Putin to achieve his goals at the expense of Western security.

David D. Laitin is the Watkins Professor of Political Science at Stanford University and co-author of  “Why Muslim Integration Fails in Christian-heritage Societies.”

James Raymond Vreeland is a professor of international relations at Georgetown University and co-author of “The Political Economy of the United Nations Security Council.”