A San Francisco sheriff caught up in a national debate on immigration reform has lost his bid for re-election by a wide-margin.

Partial returns from Tuesday's vote show Sheriff Ross Mirkarimi losing to retired sheriff's official Vicki Hennessy. She has the backing of Mayor Ed Lee and the deputies association.

With more than 90,000 votes counted, Hennessy had 62 per cent compared to just 31 per cent for Mirkarimi. Only two incumbent San Francisco sheriffs have lost re-election in the last 60 years.

Scroll down for video

Out! San Francisco Sheriff Ross Mirkarimi lost his bid for re-election on Tuesday, amid blowback for releasing a illegal Meixcan immigrant from jail. Pictured above in April

On July 1, illegal immigrant Francisco Sanchez (left) shot dead Kate Steinle, 32 (right), while the woman was walking with her father on the San Francisco waterfront

The San Francisco sheriff's office has been in the spotlight since a Mexican national in the country illegally was charged in the death of a local woman, 32-year-old Kate Steinle, who was shot dead on the San Francisco waterfront this summer.

Just four months before the shooting, the Francisco Sanchez was released from jail even though federal officials had requested that he be detained.

Sanchez's detainment was related to marijuana distribution charges that were later dropped. It is believed to have been deported five times previously.

Mirkarimi allowed Sanchez's release on the basis of the city's sanctuary policies, which generally prohibit law enforcement from cooperating with immigration officials.

Sanchez told two television stations who interviewed him in jail that he found the gun used in Steinle's killing wrapped in a shirt on the pedestrian pier she was walking on when she was killed on July 1.

Sanchez said the gun went off in his hands, and his public defender, Matt Gonzalez, said that the San Francisco woman's death appeared accidental.

However, prosecutors have said Sanchez was sitting in a swivel chair, and chose to shoot in Steinle's direction.

The Bureau of Land Management later revealed that the weapon belonged to one of their emloyees who left it in their car while in San Francisco on business

Sanchez claimed he found the gun on the waterfront and that it accidentally discharged

San Francisco declared itself a 'sanctuary city' in 1989, and since banning that ordinance, city officials passing an ordinance that bans city officials from enforcing immigration laws or asking about immigration status unless required by law or court order.

In addition to the Sanchez scandal, Mirkarimi has been plagued with other bad publicity, including a drug gang leader who escaped from jail and revelations that guards had been staging and gambling on inmate fights.

He was also forced to apologize over the botched search for a missing San Francisco General Hospital patient whose body was found decomposing a stairwell several weeks after she wandered from her room.