Last Saturday, after landing at Lisbon airport and checking Twitter, I discovered that a coup d’etat was taking place in Portugal, my home country. Or at least an English-speaking coup, since the Portuguese-speaking users in my Twitter feed were happy to ignore it.

What had started the frenzy was an article published by the Telegraph’s Ambrose Evans-Pritchard, which said that the Portuguese president, Aníbal Cavaco Silva, had taken the “explicit step of forbidding Eurosceptic parties from taking office” – a decision, the article implied, which had come about as a result of pressure exercised by “EU austerity mandarins”. But the true story of what has happened is a different one.

Each European state has its own political system, with its own peculiarities, with elements closely linked to their own national history. To outsiders, these peculiarities can sometimes look deeply undemocratic. For example, it may seem odd to some Europeans that a democratic country would have an unelected hereditary head of state and an unelected upper house that can block laws from the elected lower house of parliament. How democratic can a system be where a party with 12.6% of the vote gets one MP while another gets 56 MPs with 4.7%?

While parliamentarism is dominant in the European Union – 24 out of 28 member states follow that system – there are other systems. Portugal and France, for example, are semi-presidential republics where the president is not a ceremonial figure but directly elected by the people, with powers to appoint the prime minister or to dissolve the parliament. And the legitimate exercise of those powers is what happened in Portugal last week.

The most probable scenario is that by the end of the next month Portugal will have a leftwing government

After four years of austerity, this month’s parliamentary elections produced a messy result: Pedro Passos Coelho’s ruling rightwing Forward Portugal Alliance (PAF) won the most votes and the most seats in parliament, but lost its overall majority to anti-austerity parties – the centre-left Socialists, the radical Left Bloc and the Communists.

According to the Portuguese constitution, the president has the right to choose the prime minister “after consulting the parties with seats in the assembly of the republic and in light of the electoral results”. What the president legitimately did was to choose the leader of the coalition with the most votes, which, in the eyes of British Eurosceptics, constituted a coup. So why was the common view on the Portuguese left that the president’s decision was “a waste of time”? The good news for British commentators worried about the state of Portuguese democracy is that parliament still has the last word: after the new government has been nominated by the president, any party can table a vote of no confidence which, if approved, would bring down the nominated government.

There are some historical precedents. In 1978-80 there were three short-lived governments led by independents nominated by the president; in 1987, after the minority right-wing PSD government was censored by the parliament, a leftwing majority coalition was rejected by the president and elections were called. In 2005, while still having a majority in parliament, the rightwing PSD-PP government’s term was cut short when the president decided to dissolve the parliament.

Coups, at least real ones, are unpredictable. Yet what is going to happen in Portugal is pretty clear. Next Friday, Passos Coelho and his rightwing coalition government will be sworn in by the president. He then has 10 days to present his programme for the next four years, while the leftwing parties are likely to table a vote of no confidence that will be approved by, at least, 122 of the 230 members of parliament.

With the government rejected, the president will have to take a new decision. Theoretically, he could appoint someone else from the right or an independent that he thinks capable of putting together a coalition with the Socialists (even though the Socialists have rejected this scenario); or he could nominate the Socialist leader António Costa to form a government with guaranteed approval in parliament; or, since he can’t call a new election as he is in the last months of his mandate, he could keep the current government as a caretaker government until a new president is elected. The most probable scenario is that by the end of the next month Portugal will have a leftwing government.

What has indeed been subject to heavy criticism in Portugal was the speech of Cavaco Silva – elected with the support of the rightwing PSD and CDS – in which he criticised the Left Bloc and the Communists for their opposition to Portugal’s international compromises. This was despite the fact that the Socialists have said they would guarantee Portugal’s continued membership of the EU – including the economic union – and Nato.

Daniel Hannan, a Conservative member of the European parliament, went on to say that this supposed coup demonstrated that “you can have democracy, or you can have a political union in the EU. You can’t have both.” What Hannan and other Eurosceptics didn’t realise was that, what’s happening in Portugal has nothing to do with the structure of the EU, only with the economic measures that the rightwing government imposed on the Portuguese people, and which his own party has imposed in Britain.

While the Left Block and the Communists are indeed Eurosceptic, they don’t call for Portugal to leave the European Union or the eurozone. The biggest party in the future coalition of the left is the Socialists, who brought Portugal into the European Union and the euro, and who have called for movement towards European political union.

What happened in Portugal was not a coup – it was the action of a bad president within a bad system at a difficult point in Portuguese history. Britain’s Eurosceptics have supplied further evidence of something that has been clear to Europeans for some time: facts are increasingly becoming collateral damage in the rush for Brexit.