Rudolph W. Giuliani, a former New York mayor and an ally of Donald J. Trump’s, suggested on Sunday that “everybody” commits infidelity, setting off a backlash on Twitter.

The remark came during an exchange on NBC’s “Meet the Press,” after Chuck Todd, the show’s host, asked Mr. Giuliani whether he was “the right person” to bring up former President Bill Clinton’s infidelities in this heated campaign.

“You have your own infidelities, sir,” Mr. Todd said.

“Everybody does,” Mr. Giuliani responded. “You know, I’m a Roman Catholic and I confess those things to my priest.”

The reaction from Twitter users was swift and unforgiving.

“No Rudy — not everyone does,” wrote Diana Hess, a self-described Hillary Clinton supporter.