For generations, the New York Yankees have had a lock on City Hall, fawned over by mayors in navy jackets and trotted out as heroes at ticker-tape parades.

But in the city that gave rise to Joe DiMaggio and Yogi Berra, a once-unthinkable prospect now looms. A die-hard fan of the Boston Red Sox, the kind of enthusiast reviled across the five boroughs, could soon rule the city.

Bill de Blasio, the city’s public advocate and a leading Democratic contender for mayor, has a confession: He is a Red Sox fan, tried and true. He was raised in Cambridge, Mass., becoming a devotee of the Red Sox at 6, and he is unabashed in his disdain for anything having to do with that team from the Bronx.

“I have my loyalty to the team of my youth,” he said in an interview, calling his tie to the Red Sox a “deep devotion.”