John Krasinski’s experience proves animosity between fans of the Boston Red Sox and New York Yankees can flow both ways.

The movie star and director — also known for his role as Jim on the hit TV sitcom “The Office” — told a hilarious tale Tuesday night on “The Tonight Show” about a consequence of wearing a Red Sox jersey in New York City he endured long ago.

Krasinski, a Newton, Mass., native, said was “young, ignorant” and wearing the jersey of former Red Sox star Nomar Garciaparra in the late 1990s. What happened next is vintage New York.

“I got out of the glass doors, took a left, and I was walking along about to get lunch, and just something hit me in the back of the head,” Krasinski said. “I was like, ‘Oh my God!’ And it was a full cream cheese bagel. And I looked over to see who it was. It was a taxi going like 20 miles an hour. … He must have been drafted after that.”

Krasinski directs and stars in the upcoming film “A Quiet Place,” which will be released in theaters Friday. Chances are the taxi driver will be too busy pitching in the major leagues to catch the film on its opening night.

Thumbnail photo via Robert Hanashiro/USA TODAY Network