The U.S. population is showing signs of recovery from the pandemic after growth hit record low levels last year, and Americans mainly have people from outside of the country to thank for it.

The resident population grew by 0.4% in 2022, the Census Bureau said on Thursday, a rebound from last year when population growth almost flatlined at 0.1%. There are now 333.3 million people living in the U.S., after adding nearly 1.3 million people in the past year.

Part of that population gain comes as there were more births than deaths in the U.S. this year, adding around 245,000 people. The birth rate represents the “largest year-over-year increase in total births since 2007,” Kristie Wilder, a demographer in the Population Division at the Census Bureau, said in a statement.

But while a relatively high birth rate helped, it wasn’t the main reason U.S. population growth returned to normal levels according to the bureau.

The biggest driver was a rebound in people migrating to the U.S.

Net international migration—the number of people moving to the U.S. minus those leaving the country—was the “primary driver of growth” for the population this year, according to the census. Net migration was positive at more than one million people, a 169% leap over the 376,000 population increase due to migration in 2021.

The uptick in U.S. population growth, while still small by historical standards, is a welcome relief after declining growth became a concern for tight labor markets this year.

During the early days of the pandemic, both immigration and birth rates plummeted. In 2020, net international migration fell to 247,000, the lowest in decades, as the pandemic forced closures of visa-issuing U.S. consulates abroad and land borders between the U.S., Mexico, and Canada were shut down to non-essential travel. Birth rates in 2020 were no better, having fallen by 4% to a record low.

The decline in birth rates was largely on track with trends observed in other developed nations including Japan and Italy, where birth rates have fallen while the population continues to age. In the U.S. the declining birth rate has received special attention from employers who don’t have enough young people to hire and replace the large cohort of baby boomer Americans now on the cusp of retirement.

Immigration, especially of young people, has long been seen as a weapon to guard against declining birth rates and slowing population growth in the developed world.

With the right policies, a positive immigration flow would “reduce population decline, keep the size of the labor force from shrinking, improve age dependency ratios, and produce positive fiscal gains,” Giovanni Peri, an economist and director of the Global Migration Center at University of California at Davis, wrote in 2020.

And for countries experiencing birth rate declines, immigration can “help reverse or at least delay demographic decline and population aging,” Nadege Desiree Yameogo, a senior economist at the World Bank, argued in 2019.

In the U.S., net international migration has been slowing since between 2015 and 2016, according to the Census Bureau, largely due to the pandemic, processing backlogs, and the Trump administration’s more restrictive migration policies.

It is still unclear whether the 2022 increase in international migration will hold in future years, although every U.S. state gained new residents from abroad in 2022.

Southern states saw the largest gains in terms of both domestic and international migration, and foreign arrivals added over 400,000 new people to the region. Florida was the fastest growing state in 2022 with its population increasing by 1.9%, and saw the second-largest gains from international migration with 125,629 new residents, around 100 less than the top destination for foreigners: California.

But California, along with New York and Illinois, were the states with the largest overall population declines, as people chose to permanently leave large cities including Los Angeles, Chicago, and New York City during the pandemic.

Population declines in these states were mainly due to domestic outmigration, although like every other U.S. state, all three registered positive net international migration.

Culled from Fortune