BATH, England — The British prime minister’s blue battle bus had just arrived for a campaign stop at a factory when the booing started.

A motley crew of protesters, among them anti-fox-hunting activists and beret-wearing pro-Europeans, greeted Theresa May by playing “Liar, Liar,” the anti-May tune that has become one of the top 100 songs on the U.K. iTunes store, on repeat. Inside Cross Manufacturing, an aerospace supplier, the blue-collar workers broke into applause only after a questioner asked whether her refusal to debate other candidates on television was a sign of fear and weakness.

“Every vote for me is a vote for the strong and stable leadership which I believe this country needs,” the prime minister responded, going into repeat mode herself. “Who do you trust to have the strong and stable leadership to get on with that job of getting the best deal for Britain for Brexit, because Brexit really matters?”

Britain is having its first national election since the so-called Brexit referendum last June, when the country voted to leave the European Union, a race unfolding in the unsettling glare of two terrorist attacks that killed 29 people in the last three weeks. It has not quite turned out as Mrs. May had hoped; having tried to make the campaign about the shortcomings of the Labour leader, Jeremy Corbyn, the race is now as much about her own.