"We are going to turn off, actually prohibit, the use of ethnic affinity marketing for ads that we identify as offering housing, employment and credit," Erin Egan, Facebook's vice president of U.S. public policy, told USA TODAY.

Facebook will also require advertisers to affirm that they will not place discriminatory ads on Facebook and will offer educational materials to help advertisers understand their obligations, Egan said.

The policy changes came after discussions with New York Attorney General Eric Schneiderman, Rep. Robin Kelly (D-Illinois) and the Congressional Black Caucus, and Rep. Linda Sanchez (D-Calif.) and the Congressional Hispanic Caucus.

Policy makers and civil rights leaders were concerned that marketers would use ethnic affinity marketing to run ads that discriminate against minorities in areas where historically they have faced discrimination, Egan said. Ads that exclude people based on race, gender and other sensitive criteria are prohibited by federal law in housing and employment.

The change "strikes me as a positive approach that moves them forward towards compliance with the law and that ensures they are not facilitating discrimination," said University of Connecticut law professor Jon Bauer, an expert in housing discrimination law.

Facebook has been under fire from federal lawmakers for allowing advertisers to exclude racial and ethnic groups when placing housing ads such as an apartment for rent or a house for sale. Pro Publica brought the ability to light when it placed an ad for a housing-related event that excluded African Americans, Asian Americans, and Hispanics. The Department of Housing and Urban Development, the federal agency that enforces fair housing laws, held discussions with Facebook to address "serious concerns" about the practice.

Facebook offers advertisers multicultural marketing to target — and exclude — certain groups of Facebook users. Facebook assigns members an "Ethnic Affinity" based on the pages and posts they have liked or engaged with. It says it bans advertisers from discriminating against racial or ethnic groups.

"These tools are intended to be inclusive. That's why we created these tools," Egan said. "People have been using multicultural advertising for years in order to reach people."

Last week, a group of Facebook users filed a lawsuit seeking class action status against Facebook, asserting that this ad-targeting technology violated the Fair Housing Act and the Civil Rights Act of 1964. "There is no mechanism to prevent ad buyers from purchasing ads related to employment/housing and then excluding based on these illegal characteristics," the plaintiffs wrote in a complaint filed in the U.S. District Court for the Northern District of California. Facebook says the lawsuit is without merit and it will fight it.

Housing ads that exclude people "clearly" violate the Fair Housing Act of 1968 which prohibits the publication of any ad relating to the sale or rental of a dwelling “that indicates any preference, limitation, or discrimination based on race, color, religion, sex, handicap, familial status, or national origin," Bauer said. If ads for employment opportunities are tailored to specific racial or ethnic audiences, the people posting those ads are in violation of the 1964 Civil Rights Act, he said.

Facebook's Egan says the changes, in part, came from "constructive dialogue" with advocacy groups such as the Leadership Conference on Civil and Human Rights, the American Civil Liberties Union, the National Fair Housing Alliance, and the Center for Democracy & Technology, the Brookings Institution and Upturn.

"In light of the concerns that have been raised, we are taking this step," she said.

Rep. Yvette Clarke, D-NY and a member of the Congressional Black Caucus, said she welcomed the changes. Now Facebook needs to avoid similar problems in the future, she said in an emailed statement.

"I urge Facebook and other technology companies to address the lack of diversity in the ranks of their leadership and staff by recruiting and retaining people of color and women," she said.