SEATTLE — Amazon has agreed to stop selling school supplies and children’s jewelry that have high levels of toxic metals.

Attorney General Bob Ferguson announced Thursday that his office has reached an agreement with the online retailer after dozens of products tested positive for illegal levels of lead and cadmium.

“Having these harmful metals in these products needs to stop,” Ferguson said. “It’s too prevalent, and we hope this action sends the right message.”

Federal law says products can’t contain more than 100 parts per million of lead, and Washington law says products can’t have more than 40 parts per million of cadmium.

Two rounds of testing by the Washington state Department of Ecology found that 51 of the 84 school supply products tested had high levels of lead, cadmium, or both. One of those products, a Spiderman pencil pouch, had 40 times the legal level for lead and 23 times the legal level for cadmium, according to Ferguson.

“These products weren’t just missing the mark by a small amount,” Ferguson said. “In some cases they were missing the mark by a very significant amount. That is deeply concerning for children’s health.”

WATCH: Ferguson announces agreement with Amazon on school supplies

Most of the products were produced in China and sold by third-party sellers, according to the Attorney General's Office.

As part of the agreement, all Amazon sellers of school supplies and children’s jewelry must provide a certificate that shows their product has been tested by an accredited lab and contains safe levels of lead and cadmium. If they can’t provide that documentation, Amazon must pull the product from the site.

Amazon also issued about $200,000 in refunds for 15,000 products that tested for high levels of toxic metals. About 600 of those purchases came from Washington state, according to Ferguson.

The Attorney General's Office says most of those purchases were low quantity orders, indicating they probably came from individuals rather than groups or schools that bulk ordered.

The retail giant will also pay the state $700,000 to fund future product testing.

An Amazon spokesperson sent KING 5 the following statement Thursday:

"Customer safety is Amazon’s top priority. We work closely with our selling partners to verify that the school supplies and children’s jewelry in our store are safe and drive continuous improvement to our processes to verify the safety of these products. We welcome ongoing collaboration with the Attorney General and other agencies to promote customer safety."