The news that House Speaker Nancy Pelosi endorsed Rep. Joseph P. Kennedy III in his primary race against incumbent Sen. Edward J. Markey has many Massachusetts residents scratching their heads — at least on social media.

The perplexity flows along these lines: Why would the nation's third ranking elected official intercede in a neck-and-neck local race between two Democrats who more or less share her world view?

Here are four reasons:

1. Uber progressive and idealistic Rep. Alexandria Ocasio-Cortez is a thorn in the side of Pelosi, who by today's standards is merely progressive and an establishment power broker. Ocasio-Cortez has endorsed Markey, the champion of AOC's Green New Deal in the Senate. If you doubt the iron law of politics that the friend of an enemy is themselves an enemy, then you won't be surprised by this N.Y. Post headline: "Pelosi angers AOC by endorsing Kennedy scion in Senate race."

2. In more strategic sense, Kennedy is a popular member of Pelosi's chamber and would presumably be more indebted to the speaker than a Washington veteran such as Markey.

3. In a larger sense, Pelosi's endorsement of Kennedy and AOC's support for Markey concisely illustrate the rifts within the Democratic party between the mainstream and the progressive wings. National media tends to privilege progressive momentum over the solidity of the center. The well regarded FiveThirtyEight analytical site holds that only about thirty percent of the Democratic electorate tilts toward left progressives. And while long-term demographics may favor the left, the November electorate is expecting a centrist Biden.

4. If Pelosi can align a Massachusetts senator with her chamber's needs and Joe Biden's vision, she scores a double win. She clips the ascendent wings of rival AOC, while ever so slightly greasing the Senate skids for a President Biden. If AOC's preferred candidate in such a high profile race were to lose, that would be noteworthy. But for a Washington insider like Pelosi, another win or loss doesn't mean that much.

Those who instinctively felt that Pelosi's endorsement of Kennedy was something over and above special were right. It's not just the speaker's naked flex of her power and prominence. By endorsing Kennedy, Pelosi is breaking one of her own rules. To curb primary challenges to fellow Democrats in the House, Pelosi supports banning political consultants who work with challengers looking to unseat Democratic office holders. And that's what Kennedy seeks to do to Markey.

The context may be a shade different, but the principle is the same. But then the Kennedys and Pelosis of this world got to where they are by writing their own rules.