PHILADELPHIA — It’s never a great idea to swear at police.

But a few four-letter words may no longer bring criminal charges in Pennsylvania.

State police have agreed to stop citing the public for mere cursing as part of a settlement Tuesday of a federal free-speech lawsuit.

The American Civil Liberties Union represents Pennsylvanians who have been ticketed for cursing at an overflowing toilet, a swerving motorcyclist and a parking ticket issuer.

The citations can lead to hundreds of dollars in fines and legal costs.

ACLU lawyer Mary Catherine Roper says state troopers issued more than 700 disorderly conduct citations for cursing in a recent one-year span, and local police hundreds more. But she says the speech is legal as long as it’s nonthreatening.