Polish opposition leader Donald Tusk declared the beginning of a new era for his country after opposition parties appeared to have won enough votes in Sunday's election to oust the ruling populist party.
That party, Law and Justice, has bickered with allies and faced accusations of eroding rule of law at home in its eight years in power. It appeared that voters were mobilized like never before, voting in even greater numbers than when the nation ousted the communist authorities in 1989.
If the result predicted by an exit poll holds, Law and Justice won but also lost. It got more seats than any other party but not enough to build a government and pass laws in the legislature.
The Ipsos exit poll suggested that Law and Justice obtained 200 seats. The far-right Confederation got 12 seats, a showing the party said was a defeat.
It also showed that three opposition parties have likely won a combined 248 seats in the 460-seat lower house of parliament, the Sejm. The largest of the groups is Civic Coalition, led by Tusk, a former prime minister.
"I have been a politician for many years. I'm an athlete. Never in my life have I been so happy about taking seemingly second place. Poland won. Democracy has won. We have removed them from power," Tusk told his cheering supporters.
"This result might still be better, but already today we can say this is the end of the bad time, this is end of Law and Justice rule," Tusk added.
Law and Justice leader Jaroslaw Kaczynski acknowledged that the outcome was uncertain for his party. He told supporters at his headquarters that his party's result, at nearly 37% of the vote, according to the exit poll, was a success, making it the party to win the most votes for three parliamentary elections in a row. But he also acknowledged it might not be able to keep power.
"We must have hope and we must also know that regardless of whether we are in power or in the opposition, we will implement this (political) project in various ways and we will not allow Poland to be betrayed," Kaczynski said.
If the result holds, and Law and Justice is the single party with the most seats, then it would get the first chance to try to build a government.
It falls to President Andrzej Duda, who is an ally of Law and Justice, to tap a party to try to form a government.
Prime Minister Mateusz Morawiecki said on Polsat News that Duda "will entrust the mission of forming the government to the winning party and in this first step we will certainly try to build a parliamentary majority."
Three opposition parties, Tusk's Civic Coalition, Third Way and the New Left, ran on separate tickets but with the same promises of seeking to oust Law and Justice and restore good ties with the European Union.
Wlodzimierz Czarzasty, a leader of the Left party, vowed to work with the others to "create a democratic, strong, reasonable and predictable government."
Katarzyna Pelczynska-Nalecz, the head of election campaign for Third Way, called it a "huge day for our democracy."
"There is a lot of work to do for all of us, and it's going to be a huge challenge," she said, adding: "we are very satisfied and full of hope that things will be much better in Poland in the days, months and years to come."
Votes were still being counted and the state electoral commission says it expects to have final results by Tuesday morning.
At stake are the health of the nation's constitutional order, its legal stance on LGBTQ+ rights and abortion, and the foreign alliances of a country that has been a crucial ally to Ukraine after Russia launched its full-scale invasion.
Law and Justice has eroded checks and balances to gain more control over state institutions, including the courts, public media and the electoral process itself.
During the campaign many Poles described the vote as the most important one since 1989, when a new democracy was born after decades of communism.
Turnout Sunday appeared to be even higher than the 63% of those who voted in 1989 to oust the communists.
"It seems that we have broken a record," said Sylwester Marciniak, the head of the state electoral commission.
Despite many uncertainties ahead, what appeared certain was that support for the ruling party has shrunk since the last election in 2019 when it won nearly 44% of the vote, its popularity dented by high inflation, allegations of cronyism and bickering with European allies.
If the result holds, it marks a sharp defeat for a ruling party that adopted divisive policies at home, often pushing laws through without trying to build consensus.
Others saw economic threats in the way the party has governed and believe that high social spending has helped to fuel inflation.
There is also a high level of state ownership in the Polish economy, and the governing party has built up a system of patronage, handing out thousands of jobs and contracts to its loyalists.
A political change could open the way for the EU to release billions of euros in funding that has been withheld over what the EU viewed as democratic erosion.
The fate of Poland's relationship with Ukraine was also at stake. The Confederation party campaigned on an anti-Ukraine message, accusing the country of lacking gratitude to Poland for its help in Russia's war. Its poor showing will be a relief for Kyiv.
Around 29 million Poles from age 18 were eligible to vote. They chose 460 members of the lower house, or Sejm, and 100 for the Senate for four-year terms.
A referendum on migration, the retirement age and other issues was held simultaneously. Some government opponents called on voters to boycott the referendum.
More than 31,000 voting stations operated across Poland, while there were more than 400 voting stations abroad. In a sign of the emotions generated by the vote, more than 600,000 Poles registered to vote abroad.
Individual parties need to get at least 5% of votes to win seats in parliament, while coalitions need at least 8% of votes.