Substantial prejudice still exists for both Mormons and African Americans, despite shifting views on both groups since Barack Obama and Mitt Romney first ran for president four years ago.

Sizable pockets of voters say they would be uncomfortable with a close family member marrying someone who is black or Mormon, according to a new Washington Post-ABC News poll, with Mormons facing slightly more distrust from people outside their community.

Twenty percent of voters report discomfort with the idea of a Mormon marrying into their immediate family; 14 percent say the same for African Americans. For blacks, proximity appears key: Whites living in communities with few or no African Americans are more apt to express uneasiness than those in more diverse communities. That geographic distinction seems to matter less for Mormons.

Views of the Mormon Church and of racial prejudice in the United States have evolved over the past four years. In the time since Obama was inaugurated as the first African American president, fewer Americans say they sense discrimination against blacks in their own communities. About 37 percent of those polled say African Americans face discrimination, down from nearly half the public in January 2009. The decrease is most pronounced among whites and other non-blacks. But it is unclear whether blacks sense any shift.

At the same time, the share of all Americans with an “unfavorable” impression of the Mormon Church has dropped eight percentage points from 2007 — when Romney first sought the Republican presidential nomination — to 31 percent in the new poll. But positive ratings remain at 39 percent, hardly changed from 42 percent five years ago. Instead, more Americans express “no opinion” when asked about the Mormon faith.

It is unclear what impact such lingering discomfort is having on voters’ decision-making. Prejudice is difficult to capture accurately in polling data; voters are often reluctant to express views they perceive as socially unacceptable. Little in the new data suggests an obvious effect from voters’ comfort level with religious or racial intermarriage on the neck-and-neck battle for the presidency between Obama and Romney.

If anything, Romney may have already faced down the audience most skeptical of Mormonism during the primaries. Nearly half of white evangelical Protestants rejected the idea that Mormonism is a Christian religion in a 2011 Pew Research Center poll, and evangelicals accounted for majorities of primary voters in Iowa, South Carolina and several other states.

Although Romney lost evangelicals by wide margins to Rick Santorum and Newt Gingrich in some states, he had even larger winning margins among non-evangelical voters, especially in key states that helped him clinch the nomination.

Against Obama, Romney is having less trouble bringing evangelicals to his camp. He leads the president among the strong Republican group by 78 percent to 15 percent in the new Post-ABC poll, eclipsing John McCain’s whopping 47-point margin in 2008.

“Their philosophy and belief system is totally opposed to the Christian belief system,” said Doreen Tomlin, an evangelical Christian from Florida who plans to support Romney this fall. “I’m basically looking at his policies and not his religion.”

Polling director Jon Cohen and polling manager Peyton M. Craighill contributed to this report.