He was just “marking his territory”.
When male cats mark indiscriminately and it causes a problem, the solution is to neuter them. Just sayin’.