The killing of an American woman last week by an undocumented Mexican man has reignited the debate over how "sanctuary cities" in the US deal with illegal immigrants. How do they work?
Francisco Sanchez, 45, was charged on Monday with shooting 32-year-old Kathryn Steinle on Pier 14 in San Francisco.
Mr Sanchez, a repeat drug offender who has been deported to Mexico five times, had been in jail in the city until March when the charges were dropped and he was released.
But despite being in the country illegally, he wasn't handed over to immigration officials because San Francisco's "sanctuary" law means city authorities don't co-operate with immigration officials.
So what is a sanctuary city?
The term applies to cities in the US that have policies in place to limit the assistance given to federal immigration authorities.
It's not a legal term so the way it is implemented can vary, but the policies can be set in law or just part of local policing practices.
San Francisco passed a "City of Refuge" order in 1989 that prohibited the use of city funds to enforce federal immigration laws or to share information with federal immigration officials.
In the case of Francisco Sanchez, this meant that when the US Immigration and Customs Enforcement agency (ICE) asked to be notified prior to his release from prison, their request was ignored.
In March, ICE Director Sarah Saldana told Congress there were over 200 areas in the US - cities, counties and states - that had refused to honour the agency's requests.
Why do they exist?
The idea of declaring areas as immigrant sanctuaries got traction in the 1980s after Los Angeles told its police force to stop questioning people solely to determine their immigration status in 1979.
LA authorities put the order in place in a bid to encourage immigrant communities to work with police without having to fear being deported.
Other cities that followed suit argued that implementing government policy wasn't their job and doing so threatened community relations.
So what's the problem?
Opponents of sanctuary cities have long accused them of undermining federal law enforcement efforts and encouraging illegal immigration - and Francisco Sanchez has intensified criticism.
To make matters worse for San Francisco, Mr Sanchez reportedly told police he had chosen the city precisely because he would not be pursued by immigration officials there.
Critics of sanctuary policies have leapt on his case. Outspoken Fox News presenter Bill O'Reilly said Miss Steinle paid for the city's "irresponsible and unconstitutional decision with her life".
What does San Francisco say?
Despite the criticism, San Francisco Sheriff Ross Mirkarimi stands by the decision to ignore the ICE request and insists the sanctuary status makes the city safer.
"We're a world-renowned city with a large immigrant population. From a law enforcement perspective, we want to build trust with that population and our sanctuary city laws have allowed us to do that," he told CNN.
He claims ICE's system of requests - called "detainers" - is not legal and says they should have issued an arrest warrant for Mr Sanchez if they thought he was a threat.
What's this got to do with Donald Trump?
Billionaire businessman Donald Trump is keen to make immigration a key part of his campaign to become the Republican presidential candidate.
Speaking at his campaign's launch event, he claimed that Mexico was "sending people that have lots of problems", adding: "They're bringing drugs. They're bringing crime. They're rapists."
He was heavily criticised for his comments, but when Miss Steinle was killed he tweeted: "What about the undocumented immigrant with a record who killed the beautiful young women [sic] (in front of her father) in San Fran. Get smart!"
Democratic frontrunner Hillary Clinton called Mr Trump's comment's "disappointing" but appeared to signal a change in her view on sanctuary cities, which she's previously supported.
"Here's a case where we've deported, we've deported, we've deported. He ends back up in our country and I think the city made a mistake," she said in an interview with CNN on Monday.
"I have absolutely no support for a city that ignores the strong evidence that should be acted on," she added.