The lawsuit, which has ties to a Republican city council member and Mamdani’s past rivals, accuses the city of ignoring state law