LONDON — In the weeks after Islamic State operatives struck Paris in November 2015, the group released a prerecorded video of the killers. They stared into the camera, waved serrated knives, raged at the West and specifically warned Britain: You’re next. Footage showed scenes of London through a gunsight.

For the next 13 months, the Islamic State and those inspired by the group killed and maimed in Brussels, Berlin, Nice and Normandy as well as across the Atlantic in California and Florida. Yet the rhetoric against Britain began to feel like the frothy threats made by the group toward other countries that had avoided attacks, including Iran: loud and menacing but ultimately empty.

Until now. The strikes in the past week against the capitals of the United Kingdom and Iran followed back-to-back attacks in recent months in Britain, by an assailant who used an S.U.V. to smash into pedestrians on Westminster Bridge in March and a suicide bomber at a pop concert in Manchester in May. “This is for Allah!” the attackers were heard screaming in the latest bloodshed in London as they plunged knives into their victims.

From a publicity standpoint, the attacks in Britain and Iran are a lift to the Islamic State as it loses ground steadily in Syria, Iraq and Libya. Some analysts have interpreted the strikes as a bid by the group to demonstrate its resilience, even as its territory-holding caliphate slowly disappears.