Under pressure from gun control advocates, including New York’s attorney general, Facebook agreed Wednesday to delete posts from users selling illegal guns or offering weapons for sale without background checks. A similar policy will apply to Instagram, the company’s photo-sharing network, Facebook said. The policies announced Wednesday will be implemented over the next few weeks.

Attorney General Eric Schneiderman and gun control groups have been asking Facebook to implement such restrictions. New York requires a federal background check for private gun sales and prohibits sales of some popular firearms, such as the AR-15. His office collected evidence that some website users were willing to sell guns without background checks or otherwise violate the sales restrictions of states with tougher gun control laws.