In the end, former State Senator Daniel Squadron—progressive and reformer extraordinaire—got the man he wanted to replace him.

Brooklyn and Manhattan party bosses on Sunday effectively picked Brian Kavanagh, a longtime assemblyman from Manhattan, to be the Democratic nominee for a State Senate seat Squadron recently resigned from. With no Republican opposition, Kavanagh is poised to become the next state senator from the coveted district, which spans brownstone Brooklyn and lower Manhattan.

Squadron, who prided himself on his commitment to trying to reform government in his decade in office, left suddenly last month to join a new organization dedicated to electing more Democrats nationally. Clearly sick of Albany, he resigned his seat well after the petitioning deadline for primaries, ensuring there would be no open, normal election to fill his seat.

The backroom process that elevated Kavanagh was ultimately empowered by Squadron, and represented the kind of unseemliness he railed against during his years in Albany. There was only one scenario—an unprecedented one, according to longtime observers—that could have made Kavanagh a state senator.

This is the scenario that ultimately occurred.

“It’s a terrible process and the state law unfortunately doesn’t create a path for a good one,” Squadron admitted to Gothamist.

Since the district spans two boroughs, the Democratic party bosses in each—Keith Wright of Manhattan and Frank Seddio of Brooklyn—were allowed to determine the process to pick a new state senator. In Manhattan, more than 100 county committee members came together on Sunday at a convention to vote on Squadron’s successor. Ultimately, this vote was advisory, but everyone hoped Wright, a former assemblyman who now works for one of the most powerful lobbying firms in the state, would heed the will of these county committee members.

The county committee members voted overwhelmingly to nominate Paul Newell, a Manhattan Democratic district leader respected in reform circles, over Kavanagh. Newell won 72 percent of the vote, and would have only needed a few more votes from Brooklyn to lock in the nomination. About 65 percent of the county committee members in the district reside in Manhattan, with the other 35 in Brooklyn.

Newell is probably best known for running against Sheldon Silver, the disgraced former Assembly speaker, in 2008. For a variety of reasons, he is less acceptable to the party bosses and the powers-that-be. He has never held elected office beyond his district leader post. He was the rare Democrat to openly support Zephyr Teachout when she ran in a primary against Governor Andrew Cuomo in 2014.

And, more importantly for this process, he had been pushing allies into county committee posts, earning a reputation as one of the most politically-active district leaders.

Brooklyn didn’t have to hold a county convention, according to its own rules. Progressives in Brooklyn, along with Squadron, urged Seddio to hold a convention like Manhattan did, citing precedent—multi-borough special elections usually included joint county committee votes—and a general interest in some form for democracy. Even if the rules gave Seddio the ability to avoid a vote, he could easily have elected to hold one.

Instead, with no meaningful opposition from Wright or Squadron, Seddio announced on Saturday he was backing Kavanagh. In essence, this was a bloc vote from Brooklyn. No county committee members were able to vote. No convention was held.

Part of the reasoning was that Kavanagh, who ironically has been a loud champion of electoral reform in Albany, had the support of most elected officials in Brooklyn, along with the Working Families Party. “Frank would have preferred that there be a person selected to serve out the term as an interim senator but he works under the rules that exist. And Kavanagh was clearly the choice of his colleagues and others he consulted with,” said Bob Liff, a spokesman for Seddio.

But the process was particularly strange, even taking into account the city’s history of boss-dominated politics. The county committee in Manhattan, where a large chunk of the district lies, strongly backed Newell. There was no precedent for one borough holding a county committee vote and another allowing the county leader to unilaterally toss all his votes to a different candidate.

In fact, this was the only scenario that could have made a Kavanagh a state senator. Since his victory in Manhattan was so dominating, Newell only needed a handful of county committee votes in Brooklyn to secure the nomination. (He needed about 77 percent overall, which would have meant only 5 percent from Brooklyn.)

Instead, with the full Brooklyn vote and the fraction that voted for Kavanagh, there were enough votes to lock in the nomination for the assemblyman.

“Daniel Squadron has brought shame to his legacy,” Newell said today, still furious about the outcome.

There was plenty of backroom intrigue. Mayor Bill de Blasio told Wright and Seddio he wanted Kavanagh, not Newell, to be the next state senator, and the bosses acquiesced, Brooklyn Democratic sources say. Borough President Gale Brewer and Comptroller Scott Stringer applied similar pressure to Wright in Manhattan. All were following the will of Squadron.

“The gold standard for replacing somebody would be a primary, but state law does not permit the time for that and doesn’t require that, so each county party followed its rules,” said Kavanagh. “I’m proud of the support I have.”

In the meantime, anger is building against Seddio. The large reform club in north Brooklyn, New Kings Democrats, protested his annual post-primary breakfast at Junior’s in downtown Brooklyn this morning.

Newell is still fighting, hoping Wright stands up to Seddio and follows the will of the Manhattan county committee. A bloc vote from Manhattan could overwhelm Brooklyn, though that is not likely to happen, said Barry Weinberg, the executive director of the Manhattan Democratic Party.

“[Wright's] bound by our county rules which say you basically have to do what the convention votes,” Weinberg said, arguing that any engagement in “brinksmanship” would risk having no Democrat on the ballot, since the deadline to file paperwork is tomorrow. “He’s not willing to go that far.”