The D.C. Council passed a highly unusual measure Tuesday to bend the rules and make sure Bernie Sanders will appear on the June primary ballot in the nation’s capital.

The emergency action sidelined a challenge to Sanders’s status as a legitimate candidate following the failure by D.C. Democratic Party officials to meet a deadline to certify Sanders’s candidacy for president. And it put in play the District’s dozens of delegates and superdelegates, should the senator from Vermont sustain his challenge to front-runner Hillary Clinton until the District’s late primary, on June 14.

But the council action did not come without a fight — led by Clinton supporters. They sought to use the council interference to highlight that Sanders was in need of a legislative rescue only because his campaign had chosen to pay its way onto the D.C. ballot rather than to collect signatures as Clinton had done.

Sanders “put himself into this situation,” said D.C. Council member Vincent B. Orange (D-At Large), a chairman of Clinton’s last presidential campaign in the District. “The difference is Hillary Clinton put a crew on the ground and collected signatures — Sanders did not.”

The problem for Sanders came last month when he took advantage of a Democratic Party rule that allowed him to submit a $2,500 donation to the D.C. Democratic State Committee — in lieu of 1,000 signatures — to become certified as a candidate in the party primary.

Sanders submitted his check on time. But the committee notified the D.C. Board of Elections a day later, after the deadline to do so, and a Democratic activist challenged Sanders’s status as a result.

In an email circulated among members of the D.C. Council, the elections board’s general counsel last week told city lawmakers that the board was unlikely to certify Sanders on its own.

That thrust the issue on to the D.C. Council for a fix.

D.C. Council member Kenyan R. McDuffie (D-Ward 5), who oversees election issues, said it would be an “embarrassment for the District” to have a candidate who had followed the rules and turned in a check on time to be left off the ballot.

He introduced a measure that retroactively gave the Democratic state committee 24 hours to notify the elections board about candidates who turned in checks on time to get on the ballot.

Council member Anita Bonds (D-At Large), who is also head of the state Democratic Party, had said it was standard practice for candidates to pay and for the party to have a day to submit those names to the elections board.

But a review of election records shows major Democratic Party officials far more frequently have their campaigns collect signatures than pay for ballot access.

In 2012, President Obama was the only Democratic candidate on the ballot, and he submitted signatures instead of paying the fee. In 2008, Obama, Clinton and others also collected signatures.

The council voted unanimously to allow Sanders on the ballot, with Bonds recusing herself and Orange not voting.