When the center-right Civic Platform party ran the Polish government from 2007 to 2015, it could do no wrong. That was the reputation it earned from several of its European Union partners.

The former president, prime minister, and foreign minister—all no longer part of Poland’s political landscape—tried to do something important for a post-Communist country that had peacefully shaken off one-party rule in 1989. They wanted to establish a foreign policy that could straddle East and West. It was to be a foreign policy aimed at giving the EU a security and defense coherence while at the same time making the EU recognize the necessity of bringing Eastern Europe closer to the EU.

Judy Dempsey Dempsey is a nonresident senior fellow at Carnegie Europe and editor in chief of Strategic Europe. More > @Judy_Dempsey

The Civic Platform political elite realized that as U.S. interest in Europe waned, the EU had to start taking its own defense and security seriously. Civic Platform also campaigned hard for an EU energy security policy and an EU energy union.

The key question now facing Poland is whether the nationalist-conservative Law and Justice party (PiS), which swept back into power in October 2015, will discard these policies. If it does, there will be one big loser and one big winner. Poland will be the big loser unless PiS can reconcile its strong nationalist, patriotic, and Catholic weltanschauung with an EU anchored on openness and tolerance.

The big winner if PiS turns away from the EU will be Russia. A strong and united EU is not in Russia’s interests, as the bloc’s ability to impose sanctions on Russia for its annexation of Crimea in March 2014 and its invasion of Ukraine’s eastern Donbas region confirmed. That unity rattled the Kremlin.

PiS, which is staunchly anti-Russian and no great fan of Germany, has moved with astonishing speed to replace Civic Platform appointees. The judiciary and directors of Poland’s public television channels have been targeted. There are plans to shake up education by stressing Polish patriotism.

These changes affect the EU, in which Poland has considerable clout. As the bloc’s sixth-largest member, PiS could strengthen the EU’s growing Euroskeptic camp. That’s all the EU needs in 2016 as it awaits the British referendum on staying in or leaving the EU and the 2017 French presidential elections and confronts the ever-growing instability in the Middle East.

As for Poland’s role in the Visegrad Four grouping, which also consists of Hungary, the Czech Republic, and Slovakia, a more inward-looking Poland will do little to promote the group’s interests in Brussels at a time when the EU is increasingly ill-equipped to deal with the complexities of globalization, as Europe’s refugee crisis confirms.

If anything, the Visegrad Four risks becoming a quartet of like-minded Euroskeptics who question open economies, open societies, open borders, and the basic humanistic and humanitarian need to provide security to refugees fleeing wars and persecution. The group risks turning in on itself. Is this the Europe these countries really want after they strove so hard to join the EU?

PiS’s policies could also undo major policy successes chalked up by Civic Platform. One was opening the border between Poland and the Russian exclave of Kaliningrad. Warsaw could not have done that without Germany—or indeed Russia. Civic Platform embarked on a brave strategy to adopt a new policy toward Russia based somewhat on the Franco-German reconciliation that took place after 1945. Will PiS dump that?

Civic Platform’s other achievement was the extraordinary blossoming of relations between Warsaw and Berlin despite differences over energy policy and over the German minimum wage. Fearing competition, Berlin in January 2015 introduced a minimum wage, applying it even to Polish truck drivers passing through German territory.

Civic Platform also began the modernization of Poland’s armed forces. And of course there was Russia and the Ukraine crisis, with Poland playing a major role in the early stages of the Maidan antigovernment movement that forced former Ukrainian president Viktor Yanukovych to flee to Russia.

Above all, because of its pro-EU foreign policy and its commitment to Eastern Europe, Civic Platform used that constellation of interests to support all kinds of reforms in Georgia and Moldova. In short, Poland’s role in Europe was seen as a model and a great encouragement for the EU’s Eastern neighbors. As for Warsaw, it saw the potential strength of a united Europe and understood the difficulties of post-Soviet countries trying to transform their societies.

Yet the tensions of Poland’s own transformation process have come back to haunt the country. It began as soon as the former Solidarity leaders Lech Wałęsa and Tadeusz Mazowiecki started roundtable talks with Poland’s Communists in 1989. This was truly revolutionary for a society embarking on a transformation without signposts. The peaceful nature of the process mesmerized Poland’s Communist neighbors.

But once free and independent elections took place in Poland in 1990, the dichotomy that is today represented in the reelection of PiS emerged. In one camp were the radical, secular urban elites and economic reformers led by Leszek Balcerowicz. Their belief was that the faster Poland could adopt a market economy, the faster the Communist elite would lose its power. In the other camp were those who wanted a purge of Communists and who questioned the fast pace of economic reforms.

But it was EU membership that really changed Poland. It gave young Poles opportunities that were denied to their parents. A huge Polish diaspora is today scattered throughout Europe. Somehow, Civic Platform assumed it was unassailable. That was its greatest mistake. It failed to reach out to ordinary Poles.

Since PiS was reelected in October 2015, the European Commission has been quick to criticize the government’s plans to choose the directors of Poland’s public broadcasters. And within Poland, groups are now opposing PiS’s policies.

Poland’s stability and place in Europe lie with the voters. They elected PiS—not that the party ever made clear what its political agenda was. With Civic Platform still nursing its defeat, Poland is going to need a strong opposition to salvage the gains made over the past decade. If not, the loss to Poland, the EU, and Eastern Europe will be very, very big.