At a time when industrialized countries around the world are confronting declining birth rates and aging workforces, Canada is at the forefront of betting on immigration to stave off economic decline.

A country about as populous as California has added more than all the residents in San Francisco in a year. Last week, Canada surpassed 40 million people for the first time ever — with growth only expected to continue at a rapid pace as it welcomes more immigrant workers, refugees and foreign students across its borders.

For Prime Minister Justin Trudeau’s administration, the massive immigration experiment is a way to broaden the labor market as global competition for skilled workers intensifies. It also reflects a longer-term ambition for Canada to expand its international presence and emerge from the shadow of the neighboring U.S. — similar in size by land, but home to about eight times the population and almost 12 times the gross domestic product.