The parallels between David Cameron and Ramsay MacDonald, Britain’s first Labour prime minister, may not seem obvious at first sight. Cameron, after all, is the son of a stockbroker and a baronet’s daughter, educated at Eton and Oxford, and is every inch a Conservative. MacDonald, on the other hand, was the illegitimate son of a Morayshire farm labourer and a housemaid, left school at 15 and was for much of his life – a fact that tends to be overshadowed by his later break with Labour – a man of the socialist left.

Yet if Cameron is forced to resign as prime minister after losing the EU referendum a week from now, the two men may have something rather more specific in common. In that event, Cameron could become the first British prime minister since MacDonald, more than 90 years ago, to be brought down by the British press and, more specifically, to be ousted by the Daily Mail.

Of course, like Cameron’s putative collapse next week, MacDonald’s fall in October 1924 had many other causes. The precise role of the Daily Mail among them is much debated by historians. But it was the Mail that, four days before the 1924 general election, published the so-called Zinoviev letter. This forgery of a letter, purporting to come from a top communist in Moscow, urged the signing of a treaty with the Soviet Union in order to assist the Bolshevisation of British workers. Within a week Labour, and MacDonald, were swept from power.

To say that today’s Daily Mail relies on forgeries in its long attempt to drive Britain out of the EU, in which Cameron’s fall would be more than just collateral damage if it happens, would be false. Nor would the Mail’s campaign be the sole reason for a Brexit vote. But to say that the Daily Mail, then and now, has at its heart a rightwing political project, rather than a purely journalistic project, would not be false at all.

No newspaper in this country’s history has more consistently, and at times more rabidly, pursued political objectives than the Mail – from war with Germany in the early 20th century, to the promotion of Hitler, Mussolini and British fascism in the interwar period, to the drive to get Britain out of the EU in our own lifetimes – along with the defeat of Labour at all times, by fair means or foul. That’s why the late Michael Foot, who knew his press history much better than most politicians, could never resist the opportunity to berate any Mail journalist he came across as a lackey of “the forger’s gazette”.

There’s another consistent and important thread in the Mail’s long political story too. The Mail is a newspaper that wants power. The Mail is a player not an observer, today as in the past. It was the campaign against Stanley Baldwin’s leadership of the Tory party by Lord Rothermere’s Mail and Lord Beaverbrook’s Express in 1931 that triggered Baldwin’s famous onslaught about the proprietors aiming at power – “and power without responsibility – the prerogative of the harlot throughout the ages”. These are words that could echo through the Mail’s coverage of the EU debate without a single change, as do Baldwin’s less often quoted comments that the press were “engines of propaganda” whose methods were “falsehood, misrepresentation, half-truths [and] … suppression”.

I looked up Baldwin’s great speech this week when the Mail, unlike almost every other newspaper, put nothing whatever about the Orlando gay club massacre on its front page on Monday. By any standards this brutal attack was the main story of the day. Every other newspaper led with it. Meanwhile what was the Mail’s front-page headline? It was “Fury over plot to let 1.5m Turks in Britain”. The Orlando story wasn’t on pages two or three either. These were political priorities, not journalistic ones.

Baldwin would have understood what was happening, just as Cameron presumably does. The EU referendum is indisputably an important question facing Britain. But it is also the chosen arena for a power battle between sections of the press and the elected prime minister. It is, in one perspective, the long-sought culmination of the British press’s desire to assert its power over mere politicians. That is why, in my view, the referendum next week is not simply about the question on the ballot paper about Britain and Europe. It is also about whether democratic politics or the press shall be master in our public affairs.

Europe has long been the press’s chosen battleground for this contest. It is hard to read the Mail’s front page of 4 February, with its headline “Who will speak for England?” in any other way. This extended editorial, which dismissed the claims of Boris Johnson and Michael Gove among many others, was in essence a summons to the Mail itself to have “the courage to speak out”. (The Mail pretended that it meant the whole of the United Kingdom by this echo of a famous call in the House of Commons in 1939, but we should not be fooled.)

Speak out it unquestionably has, as the relegation of the Orlando story illustrates.

Others have done the same, abandoning all pretence of reporting in favour of editorialising, as the Sun’s full-on front-page editorial did on Tuesday, warning that “If we stay, Britain will be engulfed in a few short years by this relentlessly expanding German-dominated federal state.” The following day, the Sun told a direct lie on its front page when it said shares had been boosted by the prospect of Brexit. It even came up with an old-fashioned red scare by attacking Labour’s tensions on Europe as “Confused.commies”.

Five years ago Cameron set up the Leveson inquiry into the culture, practice and ethics of the press. The press was outraged. But Cameron was right. When Leveson reported, the press banded together to defend its autonomy. The press barons of today behaved as they always do, just like the robber barons of medieval times and the trade union barons of the mid-20th century. They fought for their untrammelled freedom to do wrong to the public.

The referendum is, in one sense, the press’s revenge for Leveson. Next week they may get their man, if Cameron falls. A vote to leave the EU would mean many things. But it would show where too much power still lies in this country. It lies not with parliament, not with democracy, not with social media, but still with a few over-mighty newspapers whose stock in trade, exactly as Baldwin said 85 years ago, is made up of falsehood, misrepresentation and half-truths.

Remain or leave? Politics or the press? The question on Thursday, just as Humpty Dumpty said, is which is to be master.

• This article was amended on 20 June 2016 to remove a “not” from the sentence, “It is hard not to read the Mail’s front page of 4 February, with its headline ‘Who will speak for England?’ in any other way.”