The California State Senate passed a bill in April that provides a number of protections to immigrants in the state in light of recent crackdowns by Immigration and Customs Enforcement. The legislation limits the power of ICE agents to draw upon the resources of local law enforcement.

With the law’s passage, California is now being called the nation’s first “sanctuary state” at a time when the Trump administration has been targeting illegal immigration and so-called sanctuary cities.

10. Maryland

> Pct. foreign born: 14.5% (9th highest)
> Median household income: $71,081 (foreign-born), $75,279 (native-born)
> Adults with a bachelor’s degree: 41.1% (foreign-born), 37.1% (native-born)
> Green cards issued in 2015: 381.5 per 100,000 (8th highest)

One of the wealthier states in the country, Maryland residents are better off than the average American by a number of socioeconomic measures, regardless of place of birth. Some 10.8% of foreign-born state residents live in poverty, far less than the 18.6% poverty rate for immigrants nationwide and just 1.0 percentage point more than the 9.8% poverty rate for U.S.-born Maryland residents. Nationwide, the poverty rate among immigrants is 3.6 percentage points greater than for natural-born citizens.

Safety and continued residency are only some of the concerns facing non-natives living in the United States. Different parts of the country provide different opportunities for earnings, education, and homeownership. Some also have large communities of fellow immigrants, whose help and support can ease the process of assimilation for new Americans.

24/7 Wall St. reviewed data on the presence and prosperity of immigrants in each state and ranked all 50 based on their favorability for foreign-born residents. California ranks as the best state for immigrants, while South Dakota ranks as the worst.

Establishing a new life and finding success in the United States can be difficult. Immigrants are far less likely to earn more than Americans who were born in the U.S., and are more likely to live in poverty.

Notably, however, unemployment tends to be lower among immigrants than among U.S.-born residents. While the unemployment rate among native-born citizens is 5.3%, it is just 5.0% for immigrants. In Alaska, one of the best states for immigrants, the unemployment rate is 2.6 percentage points lower among foreign-born workers than among U.S. natives in the labor force. This phenomenon is likely in part related to the fact that immigrants must maintain employment to have their visa renewed.

One factor determining a state’s favorability for immigrants is the share of state residents who are non-natives. This ranges from a 27.0% share in California to just 1.5% in West Virginia. Having relatively few immigrants does not necessarily imply the state is inhospitable, however, as in the case of West Virginia, which ranks third best on our list.

However, many of the best states for immigrants, such as New York, California, New Jersey, and Florida, have large immigrant populations. These states are home to major metropolitan areas with distinct communities of immigrants from countries all over the world. For new immigrants, these communities provide access to others who speak their first language and have gone through the process of becoming a full-time resident. This is a potentially helpful, if not necessary, component of a smooth transition to full integration.

While we rank states based on the economic outcomes for foreign-born residents, it is important to note that outcomes in each state tend to vary based on more than simply a resident’s status as native-born or foreign-born.

For example, naturalized immigrants — those who have been granted citizenship — overwhelmingly tend to have much higher incomes, and are much more often highly-educated, than non-citizen foreign-born residents. Among immigrants, the poverty rate for those who are citizens is 11.4% — less than the rate for native-born residents — while nearly 25% of non-citizens from other countries are poor. There are also substantial differences in economic outcomes depending on the region of origin of non-natives living in each state.

To determine the best states for immigrants, 24/7 Wall St. constructed an index consisting of five socioeconomic measures intended to reflect the success and ease of assimilation for foreign-born citizens relative to the native-born population within a given state. Three of the measures — median household income, poverty rate, and unemployment — came from the U.S. Census Bureau’s 2015 American Community Survey. The disparities in median household income, poverty rate, and unemployment among the native- and foreign-born populations were standardized using min-max normalization and added to a composite index. The index also includes the normalized value for the share of the overall state population that is foreign born, which also came from the ACS, and the number of green cards issued within the state as a share of the total number of green cards issued nationwide in the 2015 fiscal year. Green card data came from the Department of Homeland Security’s 2015 Yearbook of Immigration Statistics. Supplementary data used in our analysis but not our index, such as educational attainment, household size, and employment composition by citizenship status, also came from the ACS.

Click here to see the 10 best states for immigrants.