TODAY was supposed to be a moment for candidates in the French presidential election to go into overdrive ahead of first-round voting on April 23rd. Strict electoral rules ordinarily shut down campaigning at midnight. But last night’s fatal shooting of a policeman on the capital’s symbolic main avenue, the Champs-Elysées, has brought an abrupt early end to the campaign. The gunman, who opened fire on a police van with an automatic weapon, was shot by the police as he fled. French news reports named him as Karim Cheurfi, a 39-year-old French citizen with a history of violent crime and imprisonment, who was known to French counter-terrorism services. Investigators are treating the attack as terrorism. Most candidates, in response, cancelled their final rallies and campaign events.

François Fillon, the conservative Republican candidate, who, along with the other ten candidates was taking part in a final live television interview when the news broke, was the first to cancel his events. Others followed suit. Emmanuel Macron, a centrist independent, had planned to hold two rallies in two different towns today, but cancelled both. Candidates seemed to judge the need to appear respectful more important than that of getting on with the campaign.

This was exactly the sort of attack that French security services had feared might take place close to polling day. More than 230 people have been killed in terrorist attacks in France since January 2015. The country has been under a state of emergency since November 2015. The army regularly patrols streets and transport hubs under “Opération Sentinelle”. President François Hollande’s Socialist government has renewed these special powers five times, to cover events such as a European soccer tournament last summer and the elections this spring.

Only this week, just two days before this latest attack, the police arrested two men in Marseilles on suspicion of planning an attack linked to the election. They uncovered jihadist propaganda, as well as a haul of weapons and explosives, in a flat in the city rented by the pair, Clement Baur and Mahiedine Merabet. The suspects had plans for an “imminent and violent attack”, said Matthias Fekl, the interior minister. Security services warned three candidates in particular—Mr Fillon, Mr Macron and Marine Le Pen of the far right—that they were potential targets.

Intelligence work, and especially co-operation with agencies from other countries, including the British, has helped the French thwart a number of planned attacks. But last night’s shooting is a reminder of both the country’s continuing vulnerability and the difficulty of containing the terrorist risk. With a long land border crossed relatively easily by traffickers, automatic and semi-automatic weapons circulate more easily inside France than in, say, Britain.

In the face of a long campaign of terror on their soil, the French have remained relatively defiant. The government refused to cancel any part of last summer’s football tournament, for instance, and most events—including outdoor music festivals and political rallies—continue to take place as usual, even if under tight surveillance. Terrace cafés in Paris have been as full as ever. Election campaigns are particularly tricky. Long queues on pavements outside venues have often reflected the slow security checks as much as fervour for political candidates. Polling stations remain open and free of security checks.

This has been one of the most unpredictable elections in modern history, and the latest terrorist attack makes it only more so. If anything, it could strengthen Ms Le Pen, who has lost ground in the polls in recent weeks. In last night’s debate, she was quick to link terrorism to immigration, her favourite campaign theme, and to argue for a clamp-down on terrorist suspects listed by intelligence services, and for a tightening up of border controls. Mr Fillon, too, who has been in trouble in the polls, may benefit: with his solemn look, and experience as a former prime minister, he appears the most presidential. The candidate with the most to lose may be the 39-year-old Mr Macron. A former economy minister and ex-banker, he has no direct experience of security matters, but will be hoping that edgy voters are ready to take a gamble on him all the same.