Washington state Attorney General Bob Ferguson on Tuesday announced that Facebook Inc. has agreed to make nationwide changes to resolve his office’s investigation into allegations that the social media giant allowed third-party advertisers to discriminate against protected groups.

Lawyers from Ferguson’s office and the company’s lawyers at Munger, Tolles & Olson filed court papers in King County Superior Court on Tuesday saying that Facebook will remove the ability of advertisers to exclude ethnic and religious minorities, immigrants, and other protected groups from seeing their ads on Facebook.