Turkey’s Recep Tayyip Erdoğan likes to dish it out to the press. Last week he personally threatened an editor with espionage and “crimes against the government” that could mean a life sentence for Cumhuriyet’s Can Dündar. Also last week, journalist Mehmet Baransu went on trial accused of publishing classified documents, with prosecutors demanding a 52-year sentence. These cases fit a dangerous pattern. Turkey’s recent election has been marred by press harassment, silencing of news organisations, denials of accreditation, fines for criticising corruption and coverage favouring the president’s AKP party. A recent global survey of press freedom ranked Turkey 149th out of 180, below Zimbabwe and just above Russia.

Last week, as the election campaign neared its climax, Turkey’s president decided to attack the international media as well as the Turkish. He singled out Germany’s Die Zeit, which was accused of going berserk over the plan to build a third Istanbul airport. Then he turned on the New York Times, which he said was run by “Jewish capital” and was “raging against me”. The attack on the Times came at the end of a week in which Mr Erdoğan had personally intervened to prevent the award of an honour that was due to be presented by the mayor of Gaziantep to the paper’s former Istanbul bureau chief.

Then the president attacked the Guardian. “Do you know what an English newspaper is saying?” Mr Erdoğan told an AKP rally in Ardahan. “It says ‘poor Muslims who are not entirely westernised cannot be allowed to rule their countries on their own’.” It was shameless, Turkey’s leader said. He then warned the Guardian: “Know your place.”

Mr Erdoğan’s charge against the Guardian is without any foundation. The Guardian did not say or print the words that Mr Erdoğan claimed. Nor did it say anything like them. An editorial published here last week said the AKP had its power base among “the somewhat poorer, somewhat less westernised and more religiously inclined segments of Turkish society”, but was failing to connect with younger, more urban Turks. The article called on Turks to deny Mr Erdoğan the enhanced presidential powers he sought. Sunday’s election result did just that.

The allegation that the Guardian said poorer Muslim Turks cannot be allowed to rule their own country is a mischievous lie. It appears to have been concocted by a newspaper columnist favourable to the president, was then picked up by others, before spreading quickly on social media in Turkey. Before long it found its way – wholly unchecked – into Mr Erdoğan’s speech in Ardahan, which gave the lie a fresh turbo-charge of publicity.

Journalists have to be careful with their choice of words. When they get something wrong, as they sometimes do, they must correct it as soon and prominently as possible. In a serious case, they must also apologise. As the Guardian’s longest-serving editor, CP Scott, put it, facts are sacred. Politicians too must be careful with their words. They also must get their facts right. Mr Erdoğan got his words and facts badly wrong. Perhaps an apology is in order as well.