What exactly is driving French President Emmanuel Macron’s foreign policy?

He says he wants a more geopolitical Europe, capable of facing up to an increasingly dangerous world. But then it is hard to explain his decision to block accession talks with North Macedonia and Albania, handing the Western Balkans to Russia and China on a silver platter.

During his campaign for president, Macron presented himself as standing for a return to Europe’s basic, liberal, democratic values. Today, he brags of his recently found friendship with Hungarian strongman Viktor Orbán.

There was a time when the French president insisted that Moscow represented a worldview at loggerheads with that of the European Union. Now he says he wants to move closer to Russia and build a new security architecture more in tune with the Kremlin’s interests.

If you’re confused, you’re not the only one. It could be that those of us observing Macron are failing to understand the subtleties of foreign policy, especially when practiced by a virtuoso of the art. Perhaps all these pieces will fit together in the end, like in that famous last episode of the TV show “Lost.”

Macron is not a vulgar Islamophobe but he seems increasingly convinced that Europe is in danger of being absorbed by Islam.

Some I’ve spoken to evoke an alternative, and equally extreme, theory: The French president is simply winging it. He relishes the media attention he receives with each unexpected stance — and doesn’t much care if his next bit of contrarianism is in direct opposition to what he’s said before.

My personal theory is that it’s easier to say there’s no logic to Macron’s foreign policy than to acknowledge that its driving force is something we don’t like.

It’s starting to look like a pattern is forming. Why did France scupper talks with the Western Balkans? Macron has claimed that the accession process needs to be reformed, but he has made no proposals whatsoever on how to reform it.

That has left many in the two countries sharing a common conclusion: The real reason for Macron’s opposition is that Albania is a majority Muslim country and North Macedonia has a very large and politically active Muslim minority.

They may not be wrong. Look carefully, and it’s not hard to spot an undercurrent of Islamophobia in many of Macron’s recent foreign policy decisions.

In an interview with the Economist last week, in which he declared NATO “brain dead,” Macron was much less interested in discussing Trump than Turkey. Asked if he still believed in Article 5 — whether France is under a legal obligation to defend other NATO countries from aggression — he answered rather incredibly that he did not know.

Why not? Because he might be forced to defend Turkey — a possibility he seemed to consider more or less absurd.

In the same interview, he suddenly suggested that his real problem in the Balkans was not Albania and North Macedonia, but Bosnia-Herzegovina — specifically the “ticking time bomb” of returning jihadists.

Never mind that Bosnia-Herzegovina has sent six or seven times fewer “foreign fighters” to Syria than France or that the vast majority of them were women and children. Bosnia-Herzegovina, one of the flowers of Islamic civilization in Europe, has been put on notice. Milorad Dodik, currently serving as the Serb member of the country's presidency, expressed his strong support. Little surprise: He has been saying the same for a long time.

Finally, what about Russia? Where’s the heartfelt affinity between Europe and Russia he keeps harping on about? Given Russian President Vladimir Putin’s disregard for human rights and penchant for armed conflict, that’s pretty hard to find at the moment. Maybe Macron is thinking in grand civilizational terms? On his mind: a vast Christian world extending from Lisbon to Vladivostok facing competing civilizations represented by China, India and, closer to home, Islam.

Maybe France is now so tilted to the right on the question of Islam that Macron feels tempted — or forced — to play along.

Macron is not a vulgar Islamophobe — there are many in France who are — but he seems increasingly convinced that Europe is in danger of being absorbed by Islam and thus needs to close the door to Turkey, “dangerous" Bosnia-Herzegovina, Albania and North Macedonia and cozy up to Christian Russia. He certainly seems reluctant to admit a Muslim voice and a Muslim veto into the exclusive rooms of the European Council.

Maybe Macron no longer believes that Islam can be assimilated and the prospect of a large unassimilated Muslim community scares him more than anything. That’s certainly a possibility. He recently gave an interview to a far-right magazine, in which he mentioned the case of a veiled woman humiliated in public by a nationalist politician and failed to show any sympathy.

Or maybe Macron is being driven by domestic politics ahead of another round of local elections next year. Maybe France is now so tilted to the right on the question of Islam that Macron feels tempted — or forced — to play along.

Alas, Islamophobia, no matter how philosophical, cultured or strategic, is still just Islamophobia.

Bruno Maçães, a former Europe minister for Portugal, is a senior adviser at Flint Global in London and a nonresident senior fellow at the Hudson Institute in Washington. His book “The Dawn of Eurasia” was published by Penguin last year.