A federal judge has ruled that Chicago's ban on the sale of firearms is unconstitutional.

Judge Edmond E. Chang issued his ruling in a lawsuit by the Illinois Association of Firearms Retailers and three Chicago residents, said ABC News.

Chang noted Chicago's ban not only covers federally licensed firearms dealers, but also gifts among family members, all in the name of reducing gun violence, ABC News said.

Chang said a fundamental duty of government is to protect its citizens. However, he said it's also obligated to protect fundamental rights named in the Constitution, including the right to keep and bear arms for self-defense, said ABC News.

The judge said Chicago's ordinance goes too far in outright banning legal buyers and dealers from engaging in lawful acquisitions and lawful sales of firearms.