The act disgusted officers in San Antonio so much that they reported one of their own to internal affairs.
On bike patrol one night in May, Officer Matthew Luckhurst placed faeces between two pieces of bread, city officials said. He slipped the "faecal sandwich" into a Styrofoam container, and placed it next to a sleeping homeless man.
Then he bragged about the act to another officer.
Officers reported Luckhurst in July, which launched an unsuccessful search for the homeless man as well as an internal investigation.
It ended last week, when Luckhurst was officially fired by the city of San Antonio. But his actions had already cast a pall on a city that has become a national model for navigating the tricky relationship between the city's tax base and its homeless.
Police and city leaders rushed to say Luckhurst's act was a bad decision by a former officer that doesn't reflect the rest of the 2300-member department.
"This was a vile and disgusting act that violates our guiding principles of 'treating all with integrity, compassion, fairness and respect,'" Police Chief William McManus said in a statement to NBC-affiliate WCSH. "The fact that his fellow officers were so disgusted with his actions that they reported him to internal affairs demonstrates that this type of behaviour will never be tolerated."
In a statement, Mayor Ivy Taylor told the station: "Firing this officer was the right thing to do. His actions were a betrayal of every value we have in our community, and he is not representative of our great police force."
This was a vile and disgusting act that violates our guiding principles of 'treating all with integrity, compassion, fairness and respect.
Luckhurst's attorney told The Washington Post that the officer never gave a faecal sandwich to a homeless person - he just joked about doing it.
"There's no eyewitness to that and there's no body camera footage," Ben Siguentes told The Post. "This guy made a joke to fellow officers and the story got repeated over and over again and (the chief is) taking the story as truth when, in fact officers will often tell jokes to relieve the stress of having to deal with the most undesirable people.
"Just because (Chief) William McManus says something happened doesn't mean it's true."
City Council member Shirley Gonzales said she heard about the incident last week, as the police department moved to finalise Luckhurst's termination.
She knew the news could make an already tense homeless situation worse.
Gonzales' district includes Haven for Hope, a facility where homeless people and families receive shelter and services near San Antonio's downtown. The collection of faith-based groups, volunteers and social service organisations tries to help the homeless get homes, jobs and medical treatment.
According to a city report on homelessness, the number of homeless people in San Antonio has decreased 12 per cent since Haven for Hope opened in 2010, although there's been a recent uptick.
Luckhurst was one of 66 bike patrols officers who patrol downtown and surrounding areas. Officers on bike are more approachable and can see more detail in an urban area, but they also can get to trouble spots quickly.
The officers who patrol Prospects Courtyard have to constantly balance the needs of the homeless with the grumblings of the overwhelmed community around them, Gonzales said.
"It's a very big strain on the community of people who live around it and I live in that community," Gonzales told The Post. "These homeless people also get preyed upon because they're vulnerable. Our law enforcement is very present in the area. . . . They have a difficult job of enforcing the law, and also have to deal with a population that's very vulnerable and can also be not stable.
"Then we hear about something like this and it's very deflating."
But Luckhurst's attorney said San Antonio's bigger problem is that it's using the police department to combat an array of issues that officers simply aren't qualified to handle.
"Instead of using appropriate social services, they're using the police," Siguentes said. "Why are you using a law enforcement weapon to solve a social service issue. And when the law enforcement allegedly does something that they don't like, then they blame law enforcement."