Prime Minister Mateusz Morawiecki has said that Poland wanted to stay in the European Union, a day after a landmark court ruling that experts said could instead lead to "Polexit".

The ruling from Poland's Constitutional Court challenged the primacy of EU law over Polish law, declaring several articles in the EU treaties "incompatible" with the country's constitution.

It also warned EU institutions not to "act beyond the scope of their competences" by interfering with reforms of Poland's judiciary - a major bone of contention with Brussels.

"The entry of Poland and Central European countries into the European Union is one of the highlights of the last decades. Both for us but also for the EU itself," Mr Morawiecki said, of the bloc's 2004 eastward enlargement.

"Poland's place is and will be in the European family of nations," he said in a Facebook post after former EU chief and now opposition leader Donald Tusk called a rally in Warsaw for Sunday "to defend a European Poland".

Mateusz Morawiecki said 'Poland's place is and will be in the European family of nations'

In response, European Commission President Ursula von der Leyen vowed to firmly defend the primacy of EU law.

Calling the European Union "a community of values and laws", Ms von der Leyen said the EU "will uphold the founding principles of our Union's legal order. Our 450 million Europeans rely on this," a statement said.

The EU Justice Commissioner Didier Reynders warned that the EU would use "all the tools" at its disposal to ensure the primacy of EU law.

Before the ruling, the EU had warned that the case could have "consequences" for Poland's EU pandemic recovery funds, which have still not received approval from Brussels.

France's Europe Minister Clement Beaune called the ruling an "attack against the EU".

"It is very serious... there is a risk of a de-facto exit" of Poland from the EU," he told BFM-TV.

Luxembourg's Foreign Minister Jean Asselborn said the Polish government was playing with fire.

"The development in Poland is very, very concerning ... We have to state clearly that this government in Poland is playing with fire," Mr Asselborn said as he arrived for an EU meeting in Luxembourg.

"The primacy of European law is essential for the integration of Europe and living together in Europe. If this principle is broken, Europe as we know it, as it has been built with the Rome treaties, will cease to exist."

Polish freedom icon Lech Walesa called for new elections in the country to "save the honour of Poland".

Poland and other countries in Central and Eastern Europe joined the European Union in 2004 - 15 years after Mr Walesa's trade union activism helped overthrow the Communist regime.

In his Facebook post, Mr Morawiecki sought to play down the implications of the ruling saying that the principle of the superiority of constitutional law over other sources of law had already been stated by courts in other member states.

"We have the same rights as other countries. We want these rights to be respected. We are not an uninvited guest in the European Union. And that's why we don't agree to be treated as a second-class country," Mr Morawiecki wrote.

But experts said the ruling, which still has to be officially published to have legal force, could be a first step towards Poland one day leaving the EU.

"The ruling is absolutely inconsistent with European Union law and it should simply be ignored in the judgments of ordinary courts," said Piotr Bogdanowicz from the University of Warsaw.

"Our membership of the EU is really at stake," Mr Bogdanowicz told TOKFM radio.

Adam Bodnar, Poland's former human rights ombudsman, told TOKFM that the ruling constituted Polexit "in all but name".