Mayor Dennis Kneier was caught on neighbor Philip Lao's home surveillance camera throwing the bag filled with dog poop onto Lao's walkway on June 7.
The mayor said he and his wife were coming back from a walk near his house when they found the bag.
"Rather than leave it or dispose of it properly, I placed it on your side walkway. This was a mistake, for which I apologize. It won't happen again," Kneier said in a statement.
Lao says he recognized Kneier on surveillance video and called police. He gave the video to the San Marino Police Department, and officers photographed the bag.
There is no police record of problems between the men, but Lao claims his opposition at city council meetings to a proposal to create a dog park may have been the motivation for the poop bag.
The original owner of the waste has not been identified.
The Associated Press contributed to this report.