Image caption Chicago has suffered terrible bloodshed, including the November killing of an 18-year-old at a party

A US judge has struck down Chicago's ban on sales and transfers of firearms, finding the city went too far in its effort to prevent legal sales of guns.

Judge Edmond Chang ruled the ban was unconstitutional, but allowed it to stand while the city appealed.

The judge also said in his ruling that there was little evidence the ban was effective in reducing gun violence.

Chicago has been plagued by gang violence, and has some of the strictest gun laws in the US.

City officials say the effectiveness of the ban on gun sales has been diminished by lax gun laws in the state of Illinois and in surrounding states.

'Really careful'

Roderick Drew, a spokesman for Chicago's law department, said Mayor Rahm Emanuel disagreed with the ruling.

Media playback is unsupported on your device Media caption In May 2012 Lino Diaz became one of the 506 people killed in Chicago that year

Mr Emanuel has told the city's lawyer to consider other options to regulate firearms sales strictly, he added.

"Every year Chicago police recover more illegal guns than officers in any city in the country, a factor of lax federal laws as well as lax laws in Illinois and surrounding states," Mr Drew said told the Associated Press.

"We need stronger gun safety laws, not increased access to firearms within the city."

Gun rights advocates hailed the ruling.

The judge's decision "shows how out of step and outrageous Chicago's ordinances really are", said Todd Vandermyde of the National Rifle Association, a powerful gun lobby group.

A lawsuit against the ban was originally filed by the Illinois Association of Firearms Retailers and three Chicago residents.

One of those residents, antique gun collector Kenneth Pacholski, said the ban was unreasonable.

"All the people I know who own guns legally are really careful," said Mr Pacholski, whose wife also sued.

"I'm a collector. My guns are not going anywhere unless I know where they're going because I don't want to be responsible for someone's death."

Last year, a US appeals court struck down the state of Illinois's blanket ban on carrying concealed firearms, the last in the US. And in 2010, the US Supreme Court struck down the city's ban on owning firearms.

Chicago has struggled to turn the tide of gun violence for several years, ending 2013 with more than 400 homicides. Shootings are common in the city's South and West Sides and children as young as six-months-old have been caught in the crossfire.