The right-wing populist Law and Justice party is on course to win most seats in Poland's general election, exit polls suggest, but is unlikely to secure a third term in office.
Pollsters Ipsos suggest the party, known as PiS, has 36.1% of the vote and the centrist opposition is on 31%.
If the exit polls are correct, then Donald Tusk's Civic Coalition has a better chance of forming a coalition.
He is aiming to end eight years of PiS rule under leader Jaroslaw Kaczynski.
The PiS leader admitted he did not know if the party's "success will be able to be turned into another term in power".
Initial results give PiS the lead, but they reflect small towns and the countryside which are party strongholds. A second Ipsos poll published on Monday morning reinforced its first poll on Sunday evening.
"Poland won, democracy has won," Mr Tusk, 66, told a large crowd of jubilant supporters in what felt like a victory rally in Warsaw. "This is the end of the bad times, this is the end of the PiS government."
There were roars as the Ipsos poll flashed up on the screen and Mr Tusk appeared to loud cheers and chants of his name.
Supporters appeared stunned, and election officials said later that turnout was probably 72.9%, the highest since the fall of communism in 1989.
The Organization for Security and Co-operation in Europe - which monitors elections to check they are free and fair - said candidates in the election had been able to campaign freely - but biased coverage by the state media and misuse of public funds had given a "clear advantage" to the governing PiS.
"We noted the erosion of checks and balances to gain further control over state institutions by the governing party, including the courts and the public media," they said in a statement.
Polls closed at 21:00 local time on Sunday, but there were still queues of voters reported well into the night in Warsaw and Krakow, and into the early hours in Wroclaw.
A larger proportion of 18-29 year-olds had turned out to vote than over-60s, Ipsos said.
PiS was heading for 196 seats in the 460-seat Sejm or parliament, according to the later poll, and would fall short of the 231 needed for a majority.
It is unlikely to have much help from the far-right Confederation Party, whose leader admitted it had fared far worse than expected, with a predicted15 seats.
- Katya Adler: Poland's expected political earthquake delights Brussels
- Poland election result: What happens next?
Mr Kaczynski has painted his rival as a puppet of Berlin and Brussels and vowed to maintain his party's strong anti-migration policies.
Civic Coalition leader Donald Tusk has described the vote as Poland's most important since the fall of communism and vital for its future in the European Union.
He has vowed to improve relations with the EU and unlock €36bn (£30bn) of EU Covid pandemic recovery funds frozen in a row over PiS judicial reforms that led to staffing top courts with judges sympathetic to the ruling party.
If the two exit polls are borne out, Mr Tusk's party has more chance of forming a broad coalition, with centre-right Third Way and left-wing Lewica.
There were few smiles among PiS party faithful in the minutes before the close of polls.
"We have to hope," Mr Kaczynski declared. "Regardless of whether we are in power or whether we are in opposition, we will implement this project in various ways and we will not allow Poland to be betrayed."
PiS supporters put on a brave face, chanting "Jaroslaw" and waving Polish flags, as the later exit poll suggested they had lost 39 seats since the 2019 election.
A party spokesman told the BBC he was still hopeful of forming a government as the poll was just a prediction.
Queues formed outside polling stations across Poland and beyond on Sunday.
A marbled foyer in Warsaw's Stalinist Palace of Culture was crammed with voters, who snaked out into the square outside.
"The campaign was very strong and emotional, that's why there are so many people," a PiS voter called Agnes told the BBC.
One result of the ferocious election campaign was increased turnout. "It seems that we beat the turnout record," Poland's Electoral Commission head Sylwester Marciniak told a news conference.
Many voters in central Warsaw came with children and even pets, while election officials and security guards helped elderly voters climb the steps.
Voters talked of being nervous about the result of the election and all of them saw it as decisive for the future direction of Poland.
Whoever wins, Poland's strong support for Ukraine is unlikely to change, almost 20 months into Russia's full-scale invasion. However, PiS leaders showed signs of wavering in recent weeks, in an apparent bid to bring back voters attracted to the Ukraine-sceptic Confederation party.
"We have a war on our border. We have to be sure the government will take us in the right direction and be more resistant to Russia," said another voter called Ela.
Poles voted in more than 30,000 polling stations, and there were long queues outside Poland too, with 600,000 expats registered to vote.
"They're the most important elections I've voted in during my lifetime," said Magdalena Bozek as she queued up to vote in London. "It's been quite a difficult eight years for us, for pro-Europeans."
Civic Coalition has also vowed to liberalise abortion laws, after a near-total ban imposed in 2021.
The centre-right Third Way appeared to be one of the big winners of the night, with a predicted 14% of the vote. It has promised to simplify taxes and offer an alternative to the two big parties.
Piotr Buras, from the European Council on Foreign Relations, said an opposition victory would open the way to a "massive reorientation" of domestic and European policy. Their immediate goal would be to remove PiS figures from state institutions and public TV, he added.
Poland is divided into 41 districts and has a proportional representation system for its parliament, based on party lists. Expat votes count towards the Warsaw district.
President Andrzej Duda, an ally of the socially conservative ruling party, would normally ask the biggest party to form a government, and his aide indicated that was the traditional next step.
But if PiS fails to win a vote of confidence, then parliament would appoint a new prime minister who would then choose a government and also have to win a confidence vote in the Sejm.
That would leave PiS as Poland's caretaker government potentially into December.
Five parties are set to cross the 5% threshold and enter the 460-seat Sejm or parliament.
Poles also voted for the upper house, the Senate, and took part in four referendums that all appeared designed to bring PiS voters out to vote.
One asked whether the retirement age should increase, and another on whether Poland should accept more migrants from the rest of the EU.
Latest Stories
-
We may all resort to vote buying if electorates prioritise such over development – Asiedu Nketiah
5 mins -
NDF engages mineral extraction communities in advocacy and litigation resolution
10 mins -
Adabraka in community A/R unites to combat electoral violence
17 mins -
Forestry Commission cracks down on endangered bush meat trade
18 mins -
Global GDP could plunge by 24% by 2,100 without urgent climate action
19 mins -
High Court dismisses lecturer’s bid to block Deputy IGP’s appointment
27 mins -
MTN records 35.5% growth in profit to GH¢3.76bn in quarter 3, 2024
50 mins -
Deloitte to hold training on navigating customs and excise duty Obligations
53 mins -
Akufo-Addo, Bawumia should have prioritised National Peace Campaign launch – Mahama
53 mins -
AGI works to clamp down on substandard foreign mattresses penetrating Ghanaian markets
55 mins -
Immigration Service intercepts 54 gallons of fuel
57 mins -
Ace Medical Insurance makes its mark at Ghana Club 100 Awards
1 hour -
Dafeamekpor takes Speaker to High Court to affirm vacant seats ruling
1 hour -
Government is not funding GMX music streaming platform – Director of Marketing
1 hour -
Energy sector not advancing enough – ACEP
1 hour