On July 4, Mahmoud Esmaeili, a 33-year-old software engineer, became an American citizen. Here’s why: “I like the system here. I like the rule of law. You know what to expect and what to not expect, so you can plan. That was the major part of why I wanted to be part of America.”

The example of Esmaeili is in many ways a microcosm of our long national debate about immigrants and immigration  a debate that hinges on what it means to be an American.

Does being American depend on who you are  your country of origin, your skin color, your religion? Scholars call this an “ethnic” definition of citizenship, and it’s echoed in the Trump administration’s effort to restrict immigration from certain Muslim-majority countries  including Esmaeili’s native Iran.

Or does being American depend on what you believe, such as your respect for American ideals and institutions? Scholars call this a “civic” conceptions of citizenship. Esmaeili articulates this plainly: his very reason for becoming a citizen is his appreciation for American institutions like the rule of law.

So which conception of citizenship takes precedence in the minds of ordinary Americans? My new research sheds light on this question. I find that Americans by far prioritize what people believe, not who they are. A civic conception of citizenship creates a rare bipartisan consensus. But where that consensus breaks down  and what makes the current politics of immigration so fraught  has to do with religion.

This research is based on the View of the Electoral Research (VOTER) Survey, which interviewed 8,000 Americans in December 2016. The survey is the product of a diverse group of scholars and analysts known as the Voter Study Group, which was brought together by the Democracy Fund.

The survey asked people how important different criteria were to being an American. The graph below shows the percent who said each criterion was “very important” among all respondents, Democrats, Republicans and Donald Trump supporters in the Republican primary.

These results show that Americans are not hopelessly divided. Far from it. Nearly every respondent believes that respecting American institutions and laws (93 percent) and having American citizenship (91 percent) are very important to being American. This is true among Democrats and Republicans. Similarly large majorities believe that it is very important to accept people of diverse racial and religious backgrounds (88 percent)  which is itself an American ideal, if one we live up to only fitfully.

A majority (85 percent) also believes it is important to speak English. There is a larger gap between the parties here, but large majorities of Democrats (75 percent) and Republicans (96 percent) still believe this.

At the other end of the spectrum is “to be of European heritage of descent.” This was the criterion embraced by the fewest respondents (20 percent), including 17 percent of Democrats, 22 percent of Republicans, and 30 percent of Trump primary voters. Most Americans, although certainly not all, reject this particular ethnic conception of citizenship.

There is more ambivalence in the public overall  and much more division between Democrats and Republicans  on whether it is very important to be born in America (55 percent said this), to live in America for most of one’s life (57 percent) and to be Christian (41 percent). The importance of being Christian was the most divisive criterion, with a 26-point gap between Democrats (30 percent) and Republicans (56 percent).

There were divisions within Republicans too. While 62 percent of Trump primary supporters said being Christian was very important to being American, this sentiment was less prevalent among Ted Cruz supporters (52 percent), Marco Rubio supporters (46 percent), and John Kasich supporters (30 percent).

These results suggest a challenge and an opportunity. The challenge is clear. If the country is going to have a debate about immigration that centers on whether Muslims and other non-Christian immigrants can be truly “American,” then Americans are going to be divided, including along partisan lines. These divisions will reflect divisions on the value of having different cultures represented in an increasingly diverse United States.

But there is an opportunity as well, one that is often less visible when our divisions are so stark. The consensus on a civic definition of citizenship is strong, and in that consensus is the potential for a politics of immigration and citizenship that actually unites Americans.

That sort of politics may be difficult to imagine right now. If it comes to pass, it will probably depend less on the views of ordinary Americans. As this survey shows, public opinion has the capacity for both tolerance and exclusion. Which one prevails depends on what political leaders will ask of us.

After Esmaeili took the oath of citizenship, he said “I’m a real American now.” The question facing American voters and leaders is whether we are prepared to believe him.