An elderly man in San Francisco was mercilessly taunted while being robbed and assaulted as he collected recyclables, horrifying video shows.

The footage, which was posted to Twitter on Monday, shows an unidentified Asian man being mocked ruthlessly by onlookers during a racially charged attack that investigators believe occurred in the city’s Bayview section.

At one point, a black man is seen swinging what appears to be a metal pole at the victim, who was trying to retrieve several large bags of recycled goods he had apparently collected.

“Man, hey, go get your cans, man,” one witness said while taunting the victim. “Go get your cans, man, don’t be scared!”

Another witness kept egging on the elderly man to retaliate, video shows.

“He just robbed your dumb ass,” one bystander who recorded the incident said.

The victim was then struck in the head with the metal pole after walking toward his assailant, prompting jeers from several onlookers, according to the footage.

“They are his cans,” the man who recorded the assault said. “Go get your s–t.”

The man then added that he wouldn’t help the elderly victim, saying, “I hate Asians,” video shows.

The repulsive footage ends with a close-up of the victim’s face, showing him distraught and crying after the onslaught. An onlooker then shows him the footage on his cellphone while continuing to mock him, video shows.

No arrests had been made as of early Tuesday, a San Francisco police source told The Post. Officer Adam Lobsinger, a spokesman for the department, said in an emailed statement that detectives were “actively investigating” the incident while trying to identify the victim, witnesses and suspect.

Police acknowledged that an investigation had been launched in connection with the video on Monday.

“We appreciate everyone bringing this video to our attention,” police tweeted. “At this time, we would like to announce we have initiated an investigation into this matter and we are attempting to ID the victim and/or witnesses.”

San Francisco Mayor London Breed, meanwhile, said the actions shown on the footage were “shameful” and not reflective of the city.

“Violence, bullying and harassment are unacceptable and have no place in our city,” Breed tweeted. “We need to work to bring our communities together, not sow hatred and division.”