THE pattern is all too familiar. A tragedy makes headlines, and partisans on right and left shout that it could have been prevented—if only their favourite policies had been followed. The latest outbreak of we-told-you-so-ing follows the murder of Kathryn Steinle, a 32-year-old Californian shot, seemingly at random, as she strolled on a pier in San Francisco on July 1st. Her death is fuelling fresh rows about immigration because her alleged killer, Juan Francisco Lopez-Sanchez (above), is a Mexican with numerous drug convictions and five deportations on his record. He was at large because San Francisco officials—heeding a “sanctuary city” policy of limited co-operation with federal immigration agencies—disregarded a request from immigration officials to keep him locked up.

The case made national waves after Donald Trump, a businessman running for the Republican presidential nomination on a platform that includes angry rhetoric about immigrants spreading crime and disease, called the murder “yet another example of why we must secure our border immediately.” On the left, San Francisco’s mayor, Ed Lee, denies that his city’s sanctuary policies shield “repeat, serious and violent felons”. San Francisco’s elected sheriff, Ross Mirkarimi, blamed Immigration and Customs Enforcement (ICE) for failing to issue an arrest warrant for Mr Lopez-Sanchez. The White House spokesman, Josh Earnest, accused Republican critics of President Barack Obama’s immigration policy of blocking reforms that would focus ICE resources on dangerous felons and increase border security.

Alas, awkward facts undermine many partisan claims being made about the San Francisco killing. Start with Mr Trump, whose noisy, finger-jabbing populism has sent him surging in the opinion polls. The alleged killer was not at large because border controls failed. He has been repeatedly caught crossing the border, most recently in Texas in late 2009, an illegal entry that landed him in federal prison for almost four years. The “wall” that Mr Trump wants to build on the Mexican border would not have saved Ms Steinle’s life. The same objection applies to White House talking points that chide Republicans for blocking extra border security.

What happened next, however, undermines the don’t-blame-us claims of San Francisco’s mayor and sheriff. At the end of the alleged killer’s sentence, the federal prison sent him to San Francisco on the basis of an outstanding warrant for a 20-year-old marijuana charge, which was swiftly dropped by a local court. Mr Lopez-Sanchez walked out of a local jail on April 15th after Sheriff Mirkarimi ignored a federal request to hold him and notify ICE so that he could be deported. Under a city ordinance passed in 2013, San Francisco officials and police work with ICE only when presented with a court order or warrant, undermining the mayor’s case that repeat felons have no place to hide. But it makes no sense for the sheriff to complain that he was not sent an arrest warrant, notes Julie Myers Wood, who ran ICE from 2006 to 2008. Mr Lopez-Sanchez had already served prison time for his most recent border-crossing, and there was no new immigration crime with which to charge him.

There are real lessons to be drawn. Police and mayors in a growing number of cities turn to sanctuary policies for pragmatic reasons. They fear that if officers alert immigration agents when undocumented migrants are booked into their cells—even for fingerprinting after being caught driving without a licence—then frightened immigrant communities will stop reporting crimes. In 2014 state and local jurisdictions declined more than 12,000 ICE “detainer” requests to hold someone for immigration purposes. For comparison, about 300,000 migrants are expelled annually, two-thirds of them soon after illegally entering the country.

Other reasonable conclusions may be drawn. Comprehensive immigration reforms that bring millions in from the shadows would do much to eliminate the need for sanctuary-city policies, says John Sandweg, a former ICE boss. In the meantime, he adds, San Francisco has chosen an “extreme” version of non-co-operation. For her part Hillary Clinton, the Democratic presidential candidate, says San Francisco “made a mistake”. Alas, Ms Steinle’s murder is now part of the presidential election cycle. In that context, reasonable conclusions are not at a premium.