Since Saturday’s deadly attack in London, British Prime Minister Theresa May has traded blows with Labour leader Jeremy Corbyn over who has the worst record on countering terrorism. (Chris Ratcliffe/Bloomberg News)

A country once again buffeted by terrorism will go to the polls Thursday in the latest test of the relationship between mass violence, carried out with the most everyday of tools, and democratic debate over security and ties to the outside world.

Saturday’s attack, which left seven people dead, marked the third major terrorist strike in Britain in as many months — the first unfolding steps from Parliament and the second outside a packed pop concert in Manchester. Each was claimed by the Islamic State.

The latest assault, in which three suspects mowed down pedestrians on London Bridge before slashing their way through a nearby market, inserts an unpredictable new dynamic — the fear and uncertainty sowed by terrorism — into this week’s contest, which was already tightening.

Once projected to end in a landslide for Theresa May, the Conservative prime minister who called the election in a bid to consolidate her majority, the race has appeared less lopsided in recent days. Polls suggest it could even offer a lifeline to Jeremy Corbyn, the firebrand Labour chief whose leadership had been in doubt as his party struggled to gain traction.

The mass-casualty event will jolt the election even if it does not transform its outcome, said Edward Fieldhouse, a political scientist at the University of Manchester.

While noting that such attacks generally have a short-term effect on voters’ judgments, Fieldhouse said that because this one occurred so close to an election, “you would expect it to have some impact. And since it’s an issue around security, you would expect this to favor the more right-wing parties.”

Other experts said the attack underscores the issue of leadership, already a dominant theme in a contest where the biggest question, Britain’s exit from the European Union, has been decided.

“Individuals in times of crisis look for leaders who portray a sense of resolve and strength that in turn restores feelings of hope,” said Elizabeth J. Zechmeister, a political scientist at Vanderbilt University and co-author of “Democracy at Risk: How Terrorist Threats Affect the Public.”

The outcome, in a moment of feverish politics on both sides of the Atlantic, could shed light on how deeply Islamist terrorism has swayed Western political culture, analysts also said, as voters hostile to open borders and global markets search for candidates who promise them protection.

President Trump seemed to sense a political opening, tweeting Saturday that the latest attack in Britain illustrated the urgency of his travel ban, which has been blocked in the courts.

Timothy Snyder, a Yale historian and author of the best-selling “On Tyranny: Twenty Lessons from the Twentieth Century,” said uproar is a reaction that far-right politicians crave.

“Whereas terrorism might frighten populations, it is a welcome relief to a leader like Trump, because it gives him an opportunity to direct political discussions away from rights and welfare and toward fear and preemption,” Snyder said.

In Britain, Fieldhouse said, cultivating hysteria in that way would probably backfire with voters who pride themselves on resilience. The Conservative leader, he said, would instead seek to sow doubt about Corbyn’s credibility. On Monday, in a speech in London, May warned that there was “no time for learning on the job.”

Studies suggest that terrorism boosts incumbents, particularly conservative ones. But in this week’s election, a wrinkle is May’s six-year service as home secretary, when she oversaw policing and national security.

Bella Gough, an interior architect in London, said Saturday’s attack made clear to her “what a letdown Theresa May is.” She blamed the Conservative leader for cutting security services and said the question now is: “Who’s responsible and who can be a strong leader?”

Corbyn, stumping Sunday evening in the northern city of Carlisle, sought to capitalize on that idea, accusing May and the Conservatives of threatening public safety with cuts to the police. “You cannot protect the public on the cheap,” he said.

The Labour leader has rejected claims that he is soft on terrorism, specifically that he is sympathetic to followers of the Irish Republican Army and lenient toward Islamist militants.

May, for her part, has adopted a muscular tone, blaming the attack on the “evil ideology of Islamic extremism” and outlining several ways to crack down, including tougher jail sentences and tighter regulation of online activity.

The stern response testifies to May’s calculation that the British public is willing to trade civil liberties for “the promise of security,” Zechmeister said.

“Our work suggests that the public tends to have an appetite for exactly the type of stances that Prime Minister May has expressed” since the attack, she said.

Snyder said this may play into the hands of terrorists, who set out to provoke a harsh response. “Terrorists do what they do in part to support right-wing governments who will espouse the alienating rhetoric and exclusionary politics that help them recruit,” he said.

At the same time, Islamist extremist groups focus on elections because they see them as opportunities to effect regime change, weakening the resolve of governments participating in the coalition against militants in Iraq and Syria, said Rita Katz, director of the SITE Intelligence Group, which monitors extremist propaganda. Terrorists had their desired effect in 2004, she said, when bombings in Madrid appeared to help cast out the ruling center-right Spanish government, which had supported the war in Iraq.

Radical Islamist literature urges adherents to strike leading up to Western elections. The effect of an attack in the heart of Paris before the first round of voting in April was difficult to assess, however, as voters ousted mainstream candidates before ultimately rejecting the far-right, anti-Islam option, Marine Le Pen.

“Election time is perfect” for groups like the Islamic State, Katz said. “At the end of the day, they really want Britain to stop attacking them and weakening them in the Middle East.”

If Britain’s defiance is any indication, that outcome seems improbable. But just as those targeted by the attacks promised not to change their behavior, so, too, militants are unlikely to be dissuaded as their demands go unheeded, Katz said.

“Will they carry out attacks regardless?” she said. “Yes.”