By contrast, 45 of the state’s 62 counties lost population between 2010 and 2017. Three counties upstate — Chenango, Delaware and Hamilton — lost more than 5 percent of their population from 2010 to 2017. Another five counties lost more than 4 percent.

But Dr. Salvo is concerned that the Trump administration’s approach to immigration could hurt the city in the 2020 census. Of the 4.4 million foreign-born residents in New York State, 3.3 million live in the city, he said. If they are undercounted, he said, “New York City will be hurt relative to the rest of the state.”

“The problem with the current environment is it affects more than just the undocumented,” he said, “because undocumented immigrants are often in families with legal permanent residents, they’re in families with U.S. citizens and they’re not distinguishing each other by their legal status. What they all have in common is fear. They’re afraid for their relatives, and that might cause people not to respond to the census.”

A federal law protects the confidentiality of the census, stipulating that census responses can be used only for statistical computations by the Census Bureau. An accurate account is vital because, among other factors, it determines how much federal aid flows to local communities.

The boom in the Bronx lifted the borough’s population to 1,471,160, so the Bronx has climbed to within a few hundred people of its largest-ever total, 1,471,701 in the 1970 census.

That head count was taken seven years before “ladies and gentleman, the Bronx is burning” became a catchphrase for the borough’s slide into urban despair. Lloyd Ultan, the longtime Bronx borough historian, said “the final nail in the coffin” was the 1981 film “Fort Apache the Bronx.”

“The Bronx gained a reputation as a place with feral people living in rubble and ready to pounce on anybody passing by,” he said. “It’s easy to get a bad reputation. It’s much more difficult to recover from it, but finally, people are discovering what they should have known all along: the desirability of living in the Bronx.”