Sen. Bernie Sanders (I-Vt.) arrives as at Navy Pier in Chicago on Sunday for a presidential campaign event. (Nam Y. Huh/AP)

Sen. Bernie Sanders (Vt.), a longtime independent, signed a pledge Tuesday saying he would seek the presidency as a Democrat and govern as a Democrat if elected.

The move comes in response to a new rule from the Democratic National Committee that requires all candidates for the party’s 2020 presidential nomination to sign such a pledge — a change that some Sanders allies considered a swipe at the senator.

Sanders, who caucuses with Democrats in the Senate and has said he will support the Democratic presidential nominee in 2020 no matter how the nominating contests go, has frustrated some in the party by remaining politically independent.

He ran for president as a Democrat in 2016 but then sought reelection to his Senate seat from Vermont last year as an independent. That bid, which he won by a landslide, was backed by the Vermont Democratic Party, however.

Although Sanders began his second bid for the Democratic presidential nomination with a large rally Saturday in Brooklyn, he also has filed for reelection to his Senate seat in 2024 — as an independent.

Sanders’s ambiguous party loyalty was among the motivations behind the DNC’s rule change last year.

At the time, it drew criticism from Sanders’s boosters.

“I really don’t get the motivation for the resolution at all,” Mark Longabaugh, a Sanders consultant at the time, told Politico, noting that Sanders had collectively received more than 13 million votes in the 2016 Democratic primaries and caucuses.

“Thousands, if not millions, of those votes were young people and independents he brought into the Democratic Party,” Longabaugh said. “And I’m just stunned that the Democratic Party’s rules committee would want to try to make the Democratic Party an exclusive club.”

The pledge Sanders signed Tuesday states that the chairman of the DNC has the authority to determine “whether a presidential candidate . . . is a bona fide Democrat whose record of public service, accomplishments, public writings and/or public statements affirmatively demonstrate that the candidate is faithful to the interests, welfare and success of the Democratic Party of the United States.”