One tragedy already has occurred: The murder of a young woman as she shared a quiet moment on an iconic San Francisco pier with her father and a friend.

Kathryn Steinle was strolling along Pier 14 on July 1 when a bullet seemingly out of nowhere hit her aorta. It’s hard to imagine her father’s distress as he tried to save his 32-year-old daughter. She was rushed to the hospital but died shortly after.

Charged with murdering her is a man whose long rap sheet includes multiple convictions for drug offenses and entering our country illegally. Juan Francisco Lopez-Sanchez, an undocumented immigrant, had been deported back to Mexico five times. Federal officials wanted to send him home a sixth time.

Now Steinle’s murder will be used to cause more havoc. Ill-informed pundits and political operatives have begun milking the tragedy for all it’s worth, raising furor over the fact that the San Francisco sheriff’s office released Lopez-Sanchez more than two months before the murder.

These demagogues are railing against so-called sanctuary laws, which San Francisco has in force, suggesting that they are get-out-of-jail free cards for undocumented immigrants. Nothing could be further from the truth.

In hundreds of cities around the country, police departments cooperate with federal immigration officials. But they also maintain a distance, resisting acting as immigration agents, and they do this for a very good reason: Effective policing requires building trust with immigrant communities.

Sanctuary or refuge policies are consistent with federal goals to focus immigration enforcement on violent criminals, not the undocumented person who, say, rolls through a stop sign. Under sanctuary policies, if an undocumented immigrant commits a more serious crime, all bets are off.

Yet now comes the political blitzkrieg.

U.S. Sen. Tom Cotton, R-Ark., citing Steinle’s murder, has introduced legislation to withhold federal grants from cities with sanctuary policies.

“We ought to eliminate sanctuary cities,” said Jeb Bush in a VFW hall in New Hampshire. Bush also supports stripping federal funds from sanctuary cities.

Hillary Clinton waded in, too, telling CNN, “The city made a mistake not to deport someone that the federal government strongly felt should be deported.”

Mrs. Clinton, cities do not deport. Only the federal government has that authority and duty. Such confusion over roles is partly why this conversation has veered so far off course.

The San Francisco sheriff’s office appears to have blundered. But so did immigration officials.

Lopez-Sanchez had been released to Immigration and Customs Enforcement (ICE) for deportation multiple times, after serving prison sentences. The San Francisco Chronicle reported that in March, he was called to answer to a 20-year-old marijuana charge. The likelihood that such an old, relatively minor case would proceed was minimal. Charges were dismissed.

But the county held him for another three weeks. Meanwhile, federal officials failed to provide a warrant or court order to secure their request that Lopez-Sanchez be held. That is important and increasingly being insisted upon, as federal courts have held municipalities liable for damages when ICE overreaches. U.S. citizens have been held on ICE detainers, even after posting bond, and have gone on to sue.

Seemingly, all of this could have been straightened out with an old-fashioned phone call. The mayor of San Francisco has pointed out that the sanctuary law does not prevent the sheriff’s office from talking with immigration officials.

Now, as the conservative backlash gathers steam, let’s consider what will be lost if ignorance wins the day. Police officers have worked diligently in cities nationwide to build trust in immigrant communities so that people, regardless of their legal status in this country, can feel safe cooperating with police. The American Bar Association, the United States Conference of Mayors, the National League of Cities and attorneys general of many states have spoken in favor of this approach in the past, and have filed briefs when states like Arizona tried to force police into the role of immigration agents.

Bear in mind that conservative stalwart and former New York Mayor Rudy Giuliani helped formulate his city’s sanctuary policy and even went to court to protect it.

Police know that undocumented immigrants function within society much like everyone else — they can be victims of crime, witnesses or perpetrators. Police need the cooperation of everyone to solve and prevent crimes. The preventable loss of a young woman’s life should not be allowed to alter that pact that police have worked so long to establish.