K-9 was hired to patrol the car park and footpath outside a San Francisco animal shelter after the building was broken into twice and employees were harassed.

Like so many classic Western anti-heroes before him, he rolled (literally) into town with a singular goal in mind: cleaning up the streets, which had become a gritty hotbed of harassment, vandalism, break-ins and grift.

The only difference was that he was a slow-moving, 180-kilogram robot with a penchant for snapping hundreds of photos a minute without people's permission, and this was a major US city in 2017.

What could go wrong? Quite a bit, as it turns out.

In the past month, his first on the job, K-9 – a 5-foot-tall, 3-foot-wide K5 Autonomous Data Machine that can be rented for US$6 (NZ$8.58) an hour from Silicon Valley startup Knightscope – was battered with barbecue sauce, allegedly smeared with faeces and nearly toppled by an attacker on his beat in San Francisco's Mission District.

READ MORE:

* US security robot drowns in fountain, internet erupts

* Robot battle win to take Manawatū kids to US

* Creepy robot is now a citizen of Saudi Arabia

* Robot dentist completes surgery with no human help

* Everything you think you know about AI is wrong

Supplied The backlash began after an SPCA spokeswoman implied that the robot was an effective tool for eliminating the homeless encampments outside the organisation's building.

As if those incidents weren't bad enough, K-9 was also accused of discriminating against homeless people who had taken up refuge on the footpaths he was assigned to patrol.

It was those troubling allegations, which went viral this week, that sparked public outrage and prompted K-9's employers – the San Francisco chapter of the animal rescue group SPCA – to pull the plug on their newly minted robot security pilot programme.

In July, a K5 robot patrolling Washington Harbour ended up in a fountain.

"Effective immediately, the San Francisco SPCA has suspended its security robot pilot programme," Jennifer Scarlett, the SPCA's president, said in a statement on Thursday (Friday NZ time).

"We piloted the robot programme in an effort to improve the security around our campus and to create a safe atmosphere for staff, volunteers, clients and animals. Clearly, it backfired."

SPCA officials said the robot was hired to patrol the car park and footpath outside the animal shelter after the building had been broken into twice and employees had become fed up with harassment.

The robot, they said, would be able to snap photos, record security footage, and then notify shelter employees or police during an emergency.

The backlash began after an animal shelter spokeswoman, in an interview with the San Francisco Business Times this week, seemed to suggest that the robot was an effective tool for eliminating the homeless encampments outside the SPCA, leading to a sudden reduction in crime.

SPCA officials now say they didn't mean to imply that they wanted to be rid of the homeless and have pointed out that they partner with several local organisations to provide veterinary care for homeless pet owners.

Nevertheless, a public outcry, complete with calls for the robot's destruction, quickly ensued. A flurry of attention-grabbing headlines implied that the robot was specifically employed to target the homeless.

"Robot wages war on the homeless," a particularly inflammatory Newsweek headline read.

In recent days, SPCA officials said, they've received hundreds of messages encouraging people to seek retribution against the animal shelter through violence and vandalism. So far, officials said, the facility has experienced two acts of vandalism.

"The SF SPCA was exploring the use of a robot to prevent additional burglaries at our facility and to deter other crimes that frequently occur on our campus – like car break-ins, harassment, vandalism, and graffiti – not to disrupt homeless people," Scarlett's statement said.

"We regret that our words were ill-chosen. They did not properly convey the pilot programme's intent and they inaccurately reflected our values.

"We are a nonprofit that is extremely sensitive to the issues of homelessness."

In a statement, Knightscope referred to accusations that its robot was hired to target homeless people as "sensationalised reports".

"The SCPA has the right to protect its property, employees and visitors, and Knightscope is dedicated to helping them achieve this goal," the statement said. "The SPCA has reported fewer car break-ins and overall improved safety and quality of the surrounding area."

K-9 is not the first Knightscope machine to have a short-lived security career. In July, a K5 robot patrolling Washington Harbour ended up in a fountain, its cone-shaped body halfway submerged in a scene reminiscent of a violent crime.

Images of that robot circulated widely on social media, and, eventually, a memorial with flowers and letters was set up to mourn the short-lived career of "Steve", as the machine came to be known.

Knightscope called Steve's demise "an isolated event" before delivering his replacement, an identical K5 known as "Rosie".