Why do people say "pardon my French" when they curse?

I thought it was the language of love!!!

TWAG: Based on old movies, it seems that the phrase gained popularity after WWI. I’d guess that returning doughboys might have picked up the habit of using rude words, and when one slipped out in polite company they attempted to cover the faux pas by explaining the word is a French one that just happens to sound like a rude word in English but is actually innocent.

ISTR this being asked before, and I made the same guess. I don’t remember if I was shown to be incorrect.

Pardon my French

When did cusswords become “French?”

*My contribution to a pretty interesting thread two years ago.