Google and Amazon, two of the biggest platforms for online shopping, have been offering for sale and profiting from listings of firearm and gun accessories, an apparent violation of their own stated policies that shows the pitfalls of software-driven retail.

The companies as recently as Monday, within days of three mass shootings that have shaken the nation, were offering rifle magazines for sale on their sites, including models with a capacity to hold 25 or more bullets.

On its Shopping site, which offers retail goods from vendors across the Web, Google had listings for boxes of shotgun rounds like the $31.25 20-round Hornady Critical Defense set, described on the manufacturer’s website as able to “place all projectiles on a man-sized target at seven yards” and “provide excellent penetration.”

Google bans the promotion of products that “cause damage, harm or injury,” so the listings that direct users to retail sites are not allowed and should have been detected by the company’s software and removed. For instance, a search for “bump stock,” which Google banned after the device for rapid firing was used in the 2017 Las Vegas massacre, produces no results.

Amazon’s online policy lists dozens of banned wares related to gun use. But on Monday the retailer was offering ammunition clips such as the Butler Creek 25-round magazine, an attachment for rifles used to store multiple bullets. Amazon says it ships the $45.99 item to customers itself, suggesting it stores it in one of its warehouses.

“The sale of weapons, guns, and certain gun parts is strictly prohibited on Google Shopping,” said Google spokeswoman Caroline Klapper-Matos. “As soon as we found policy-violating results, we removed them and are working to prevent these instances from reoccurring.”

“All sellers are required to follow our selling guidelines and those who do not will be subject to action, including potential removal of their account,” said Amazon spokeswoman Cecilia Fan. (Amazon chief executive Jeff Bezos owns The Washington Post.)

After being contacted by The Post, Google eliminated some of the listings, such as the Hornady rounds and a box of Remington hollow-point rounds, which could be found by searching for “ammunition” on the Shopping site and clicking an option for “Buy with Google.” It also eliminated some results noted by The Post found for “rifle magazine” and “ammunition belt.” Amazon on Tuesday pulled down listings for some rifle magazines after being notified Monday.

The availability of the goods speaks to the limitations of the company’s algorithms to keep even prohibited items from making their way to the websites. Algorithms play a huge role in policing the Internet, by automatically weeding out prohibited language, images and other disallowed things. Technology companies constantly update the software, often in response to new internal policies or societal change. There is renewed scrutiny over firearm sales after gunmen killed 35 people and injured dozens more in a one-week stretch in three different U.S. cities. Some Democratic presidential candidates renewed calls for tighter controls on assault weapon sales, and protesters flocked to the National Rifle Association headquarters to demand stronger gun laws.

Google’s list of prohibited products includes ammunition, as well as firearms, scopes, ammunition belts and guides for 3-D printing of guns, according to a policy it published online. Still, The Post found examples of each on the Shopping site, including goods that could be purchased directly through Google, rather than by being routed to the merchant’s website. Google Shopping shows millions of products for sale across the Web, some of which are available to buy using Google as the credit card processor.

More than half of all goods on Amazon are now sold by independent merchants, and many of those items are shipped directly to consumers without Amazon’s direct involvement in the fulfillment process. But if the online retailer fulfills and ships the item to a customer — something typically required to gain the Prime shipping designation — it means that a merchant usually ships that item for storage to an Amazon warehouse. Then Amazon sends it to the customer once they click buy.

Some tech companies are actively seeking to rein in gun sales, such as software provider Salesforce, which in recent weeks has indicated to some retailers it will stop providing its services if they don’t halt the sale of assault rifles, The Post reported in May.

Google earlier Monday eliminated a 100-round magazine similar to that used by the gunman in Dayton, Ohio, that allowed him to kill nine people in 30 seconds before police struck him down. Google took action on that item after Twitter user Pinboard noted the listing Monday afternoon.

Some items seem to fall in a gray area.

Gun grips and realistic-looking fake rifles still remain for sale on Google in apparent violation of its policies. Google’s Klapper-Matos said toy guns that “don’t shoot anything” are allowable. However, Google’s stated policy says “we err on the side of caution” and that it doesn’t allow firearms “that appear to be real guns.”

On Amazon, some listings remained under a search for “rifle magazine,” including a sponsored result for a Crosman brand magazine for a .22 caliber air rifle, meaning the seller paid Amazon to advertise it. Amazon said the Crosman magazine is for air rifles and therefore allowable. However, its stated policy bans “gun parts and accessories, even when designed or marketed for use with paintball, airsoft, or air guns.”