(CNN) -- A federal judge ruled Monday that Chicago's ban on virtually all sales and transfers of firearms is unconstitutional.
\"The stark reality facing the City each year is thousands of shooting victims and hundreds of murders committed with a gun. But on the other side of this case is another feature of government: certain fundamental rights are protected by the Constitution, put outside government's reach, including the right to keep and bear arms for self-defense under the Second Amendment,\" wrote U.S. District Judge Edmond Chang.
\"Chicago's ordinance goes too far in outright banning legal buyers and legal dealers from engaging in lawful acquisitions and lawful sales of firearms,\" he continued.
Chang explicitly did not rule out other types of regulation, short of a complete ban, in order to \"minimize the access of criminals to firearms and to track the ownership of firearms.
\"But the flat ban on legitimate sales and transfers does not fit closely with those goals,\" Chang wrote.
The judge stayed his ruling to give the city time to file an appeal.
The FBI's latest annual crime report showed Chicago had 500 homicides in 2012, up from 431 in 2011 and more than any other American city.
Still, Chicago does not have the highest homicide rate in the United States.
That unwanted distinction belongs to Flint, Michigan, with one homicide for every 1,613 residents, according to the FBI data. Detroit is close behind, with one killing for every 1,832 residents.