A toy machine gun with its barrel tip covered. (Charles Krupa/AP)

The state of New York is cracking down on the sale of realistic-looking toy guns as five major retailers have agreed to pull the items from their shelves.

Wal-Mart, Amazon, Kmart, Sears and California-based ACTA agreed to pay a combined total of $300,000 in penalties for illegally selling “imitation weapons,” New York Attorney General Eric Schneiderman announced Monday. According to Schneiderman’s office, those retailers sold 6,429 prohibited toy guns between 2012 and 2014.

[The troubled legacy of toy guns]

New York state law prohibits the sale of aluminum toy guns and requires toy guns to have special markings on the sides and the tip of the barrel. As part of the agreement, the companies also agreed to abide by New York City’s stricter toy-gun law, which requires all toy guns to be brightly colored.

Realistic toy guns have become an issue again following high-profile police shootings last year. In September, police stormed an Ohio Wal-Mart and shot and killed John Crawford III, who had picked up from a store shelf an air rifle that shoots BBs. Months later, a Cleveland police officer shot and killed 12-year-old Tamir Rice, who had a BB gun.

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

[Why this Manhattan gun store didn’t actually sell guns]

National Conference of State Legislatures records show that sales of imitation guns are restricted in at least 12 states, the Associated Press reported.

Since 1994 in New York state, there have been at least 63 shootings, eight of them fatal, involving someone holding a toy gun, according to Schneiderman’s office.

Appearing Monday on the “Today” showy, Schneiderman said those shootings are “unacceptable,” and he held up a neon-colored toy rifle as an example of the kind of toy gun the retailers will now be restricted to selling. “No one is going to hand over their wallet because they’re being held up by this and no police officer is ever going to mistake this for a real gun and shoot someone in a tragic incident,” he said.

The New York investigation found that four of the retailers sold the prohibited toy guns online, sometimes via third-party sellers using their sites, while Kmart sold them in its physical stores. Schneiderman’s office also sent cease-and-desist letters to 67 third-party sellers.

A Sears Holdings spokesman told the Times that the company was “pleased” to have resolved the issue. Sears also owns Kmart.

Wal-Mart had to pay higher fines because it violated a 2003 agreement with the attorney general’s office; although the company stopped selling the items in store, the guns were still being sold online.

“Once the New York attorney general expressed concern with certain items sold at Walmart.com we blocked the shipment of those items into the state,” a Wal-Mart spokesman told the Times. “We are pleased we were able to resolve this matter, along with several other retailers.”