Walmart, Amazon and Sears are among five retailers that have agreed to stop selling realistic-looking guns in New York.

The move is part of a settlement with the New York state attorney general’s office, which found that five retailers and their third-party sellers had sold more than 6,400 toy guns from 2012 to 2014, violating the city’s laws.

New York state bans the sale of black, blue, silver or aluminim toy guns and requires that imitation guns should be brightly coloured.

State attorney general Eric Schneiderman also said that the retailers must pay a combined total of $300,000 (£193,300) in penalties.

Regulation around the sale of toy guns has tightened in the US after a Cleveland police officer fatally shot 12-year-old Tamir Rice in November last year. The police officer was responding to a call that Rice was pointing a gun. It was found to be a toy gun.

“There have been instances in states around the country in which police officers have mistaken toy guns for actual guns,” said Schneiderman said in an interview. “It’s an absolutely unnecessary risk, because toy guns, as New York law requires, can be easily distinguishable.”

This year a wave of other states including Florida, Indiana, Massachusetts, Nebraska, Ohio and Washington introduced legislation to create or amend toy gun laws, said the New York Times.