The Greek government had been trying to pass the bill for more than a year as it sought ways to confront the rise of the neo-Nazi Golden Dawn party and a surge in anti-immigrant violence.