“This isn’t going to make me very popular in this room but the petition is hereby denied,” Manhattan Supreme Court Justice Arthur Engoron ruled from the bench.

Trial attorney Mark Moody had sued the state and city Board of Elections shortly after April’s primary elections, saying that million of New Yorkers– including President-elect Donald Trump’s own kids– were barred from voting in the presidential primary because they didn’t change their party affiliation before the October 2015 deadline.

Sanders performed better in states with open primaries.

Moody argued in court Tuesday that the system is unconstitutional because in disenfranchises voters who are not registered with a major party.

State attorney Roderick Arz countered, “this is not disenfranchisement, this is a decision to apply a broadly applicable deadline.”

Judge Engoron agreed that political parties have a right to regulate their primaries “as long as they don’t run afoul of constitutional dictates” like gender or racial discrimination. Moody said he’s likely to appeal.