Political activism must run in the Affleck family.

Cambridge native and actor Casey Affleck mailed a letter to elected Massachusetts officials at the State House this week, urging them to co-sponsor a bill that would put an end to what he called “deeply unethical” practices that harm farm animals.

Whether they are chickens, pigs, cats or dogs, he said, growing up near the Hub taught Affleck that all animals have the ability to feel “pain, pleasure, fear and joy.”

“For a long time our legal system has attempted to protect only pets from pain and suffering, not farm animals,” Affleck wrote in the later, dated January 29, and signed by the actor.

“This gap in legal protection allows calves and mother pigs to be confined in isolation pens, never to turn around or socialize, for their entire lives,” Affleck argued, adding that the practices should be banned outright.

Called the “Massachusetts Prevention of Farm Cruelty Act,” the legislation, if passed, would prohibit three industrial agricultural practices in the farming industry, including veal crates, gestation crates, and battery cages.

The Farm Sanctuary, the ASPCA and the Massachusetts Society for the Prevention of Cruelty to Animals backed the bill, which was filed on January 9.

“[This bill] will grant basic support for these animals who have suffered so much already,” Affleck said. “I hope you will give it your full support.”