A robot patrolling a street in San Francisco to ward off homeless people has been removed after complaints from locals, who also knocked it over and smeared it with feces.

The Knightscope K5 security robot was deployed by the San Francisco branch of the Society for the Prevention of Cruelty to Animals (SPCA) to deter homeless people from sleeping and loitering near its building.

But it was forced to take away the 400-pound machine as it was operating in the public realm without a permit, and threatened with a $1,000-a-day (£745) fine.

The K5's presence also angered the local community, who took to social media to complain.

I can’t help but feel bad for the SPCA robot outside that someone smeared their poo on. Is this a conspiracy to make me (us) a sympathizer to our new robot overlords... will they be plastered in cute dog decals?? — Tyson Kallberg (@TysonKallberg) November 9, 2017

Reports claimed that a group doused its sensors with barbecue sauce, knocked it over and veiled it with a tarp. One Twitter user claimed they saw feces smeared on its shell, while another described the robot's use as "shameful".

"The money that was spent on these robots could have gone towards homeless shelters," said another tweet.

The shelter said it released the robot, nicknamed K9, to patrol the pavements around its centre in the Mission District, which had become a camp for the city's homeless population.

"We weren't able to use the sidewalks at all when there's needles and tents, and bikes, so from a walking standpoint I find the robot much easier to navigate than an encampment," the SPCA's president Jennifer Scarlett told the Business Times.

Responding to Dezeen, the shelter said that it only hoped to improve the safety of its employees, following an influx of crime in the surrounding area, and that it is "extremely sensitive" to the issue of homelessness.

Related story Grocery-delivering robots by Skype co-founders to be tested in London next year

"In the last year we've experienced a great deal of car break-ins, theft, and vandalism that has made us concerned about the security and safety of the people on our campus," the SPCA's media relations manager Krista Maloney told Dezeen.

"The security robot that we've been using on a pilot basis has been very effective at deterring these criminal incidents. The device helps us prevent crime; it doesn't attempt to remove homeless people from the sidewalk."

The K5 is equipped with four cameras that monitor its surroundings, and moves on wheels at speeds of up to three miles per hour. It measures 1.5 metres tall and nearly one metre wide at its base, creating a sizeable obstacle on the pavement.

San Francisco is tightening restrictions on autonomous machines on the streets – particularly delivery robots – with growing concerns over public safety.

Knightscope's K5 model has already been embroiled in other controversies elsewhere, including knocking a toddler over in Silicon Valley, and falling into a pond in Washington DC after missing a set of stairs.