A North Carolina state Supreme Court hopeful plans to drop out of his race if he can’t have his party affiliation listed on the November ballot.

Raleigh attorney Chris Anglin filed paperwork Wednesday with the state elections board asking to end his candidacy if his lawsuit seeking to be listed as a Republican is unsuccessful. The board will evaluate his request after the lawsuit is resolved.

Anglin sued Republican legislative leaders this week over a new law that removes a judicial candidate’s affiliation if it changes less than 90 days before filing.

Anglin switched from a Democratic affiliation three weeks before filing. He wants the law declared unconstitutional and his GOP designation retained. He says it benefits the incumbent Republican opponent unfairly.