When Poland’s ruling rightwing Law and Justice party (PiS) published proposals in July 2017 to give the government direct control over the judiciary, hundreds of thousands of Poles took to the streets, holding vigils in front of courthouses and carrying banners with slogans such as “Free courts” and “Freedom, equality, democracy”.

But according to a programme on national broadcaster TVP’s news channel, the protesters had a secret agenda guided by a hostile foreign power. The scenes on the street, it said, were a “street revolt to bring Islamic immigrants to Poland” and backed by EU leaders as revenge for the refusal of PiS to accept migrants under a European relocation scheme.

Another programme on the channel, part of a network funded by a mix of TV licence revenues and advertising, described opponents as “defenders of paedophiles and alimony-dodgers”.

Such language has been par for the course since PiS passed legislation to give itself direct control of the public broadcaster soon after its victory in parliamentary elections in 2015, raising concerns about Poland’s media environment ahead of Sunday’s parliamentary election. Aggressively partisan news coverage routinely portrays the government’s opponents as scheming to frustrate the will and wellbeing of the Polish people, as embodied by PiS. Government policies are “good for Poles” while the opposition’s are “empty promises”.

With just days left of a campaign in which PiS has tried to mobilise its conservative base with attacks on LGBT rights, TVP is set on Thursday night to broadcast a self-styled documentary called Invasion which promises to reveal “the inside story, aims, methods, and money behind the LGBT invasion” of Poland.

It has also repeatedly claimed the opposition is intent on impoverishing ordinary Poles by rolling back welfare programmes and deliberately negotiating a less generous financial settlement from the EU.

An analysis of the content of TVP’s flagship evening news programme by Poland’s Society of Journalists found that in the two weeks before the May European elections, of the 105 items about the polls, 69 items were focused on PiS, of which 68 were classified as positive and one as neutral. Every one of the 33 items about the opposition was negative.

A separate study, conducted by the Council for the Protection of the Polish Language, a body affiliated with the Polish Academy of Sciences, also found that TVP was systematically portraying the ruling party in a positive light. Items relating to PiS routinely used words such as “reform”, “sovereign”, “strong”, “hero”, and “patriotic”, while items about the opposition tended to deploy words such as “shocking”, “scandalous”, “provocation” and “putsch”.

“I am old enough to remember Communist-controlled television in the 1980s, and I can safely say that what we have now is cruder, more primitive, and more aggressive than anything that was broadcast at that time,” said Rafał Pankowski, a professor at Collegium Civitas in Warsaw and director of the Never Again association, an anti-racism campaign group. “Sadly, many people are influenced by it.”

On several occasions, the broadcaster’s outlets have engaged in crude acts of censorship to spare the government’s blushes. Barack Obama’s concerns about PiS’s attempts to assert direct control over the country’s highest constitutional court expressed at a 2016 Nato summit in Warsaw were edited in such way that only his praise for Poland was broadcast.

Critics also accuse PiS of using TVP to promote narratives that range from the casually offensive to the incendiary. One regular guest on a political debate show recently claimed that “leftist” advocates of abortion rights were demanding the right to kill children up to the age of three years old. The claim went unchallenged.

TVP is overseen by Jacek Kurski, a former PiS MEP appointed after the Polish parliament voted in 2015 to remove the broadcaster’s senior management and give the power of appointment to the country’s treasury minister.

Hundreds of journalists were subsequently dismissed. Since PiS took office in 2015, Poland has fallen from 18th to 59th place in the Reporters Without Borders World Press Freedom Index.

PiS leaders and supporters argue that the party’s control of TVP is a necessary and proportionate response to what it argues is a wider media environment skewed in favour of its liberal opponents.

Pointing to the fact that many private media outlets are foreign-owned, they argue this leads them to serve the interests of foreign countries rather than those of Poland.

Media freedom may deteriorate after the election. Observers note that a convincing majority in Sunday’s elections would allow PiS to introduce long-touted anti-monopoly legislation designed to impose new limits on the stake that can be held by a foreign company in Polish media outlets.

Krzystof Czabański, the former PiS MP who heads Poland’s National Media Council, has claimed that some private media outlets constituted “the armed wing of the political opposition” and asked: “When media belonging to German capital attack our government … whose national interests they are implementing?”

“PiS claims that they want to ensure pluralism in Polish media,” said Jacek Kucharczyk, president of Poland’s Institute of Public Affairs. “In fact, the plan seems to be to force foreign owners to sell their shares in media to state-controlled companies or PiS-friendly oligarchs.”