The two host cities for the Republican and Democratic national conventions are both former urban dynamos that fell on hard times. In 1950, Philadelphia, which is hosting the Democratic convention this week, was the country’s third-largest city, with more than 2 million people. Cleveland, which hosted the Republicans last week, was the seventh-largest, with a population of more than 900,000. But over the next 50 years, hundreds of thousands of people left both cities, as crime rose and their economies sputtered.

More recently, however, the two cities’ fates have diverged.

Now, Philadelphia is the fifth-largest city in the country, and its population, while down 24 percent in 2015 from 1950, has been rebounding in recent years. But Cleveland keeps declining — its population is down 58 percent from 1950, and it is just the 51st most populous city in the country. Losing residents makes it harder for a city to collect the taxes needed to pay for fixed costs and can rob it of the efficiency and vibrancy of a dense urban core. It’s also just a bad sign of a city’s overall health that more people want to move away than move in. And it brings bad publicity, though the positive spin in Cleveland is that the decrease is at least slowing.

This tale of two cities is a familiar tale in the many U.S. cities that shrank in the latter half of the 20th century. Some northern cities started to decline after 1950 as manufacturing plants moved or closed and as many middle-class residents moved to suburbs, encouraged by the subsidized construction of highways, or moved south in what some demographers call the snow-belt-to-sun-belt migration. Some cities, such as Philadelphia and others in the Northeast, are starting to rebound. Others, like Cleveland and several other former Rust Belt giants, are being left behind.

Urban scholars say the two host cities’ declines happened for different reasons, which helps explain their diverging fortunes. Cleveland’s decline mirrors that of other Rust Belt cities such as Detroit’s, keyed mostly by manufacturing. Philadelphia always had a more diverse economy.

“Both regions were specialized in manufacturing in the mid-20th century, but Cleveland to a far greater degree,” Alan Berube, deputy director of the Brookings Metropolitan Policy Program, said in an email. In 1975, 31 percent of the Philadelphia metro area’s jobs were in manufacturing. That had declined to 14 percent by 1990 as the city was forced to diversify further, and it stands at 6 percent today. In addition to its textile factories and shipyards, Philadelphia also had a thriving port and robust accounting, banking and insurance industries, Berube said.

But in Cleveland, diversification has been slower, so it has had fewer high-paying jobs in other sectors to offset the decline in manufacturing. In 1975, 32 percent of the metro area’s jobs were in manufacturing. By 1990, that had fallen to 22 percent, and it is at 11 percent today. The declines in manufacturing jobs were about as steep as Philadelphia’s, but jobs in other sectors didn’t pick up as much slack.

“Cleveland is in more of a manufacturing belt and is somewhat less diversified in the knowledge-based industries — eds and meds,” said Brookings demographer William Frey, referring to education and medicine, two major sources of high-paying service jobs.

Philadelphia has also benefited from its proximity to New York, Boston and Washington, D.C. — what some demographers call the Northeast megalopolis — as high rents in those cities have spurred some businesses and residents to move to Philly. “A lot of it is geography,” said Tracy Gordon, a senior fellow with the Urban-Brookings Tax Policy Center. “Cleveland is a little more remote from other economic bases.”

Geography alone wasn’t enough to keep Philadelphia from losing residents to other regions of the country. The city’s metro area lost at least 5,000 people, net, to internal U.S. migration each year from 2001 to 2015 — meaning at least 5,000 more people each year moved out of the city to other parts of the country than moved into it, according to census data that Frey analyzed. Cleveland’s metro area lost at least 4,500 people in each of those years to internal migration, from a much smaller base. Both cities lost more young adults, college graduates and seniors than they gained from 2004 to 2014, according to Brookings data.

But Philadelphia, like other eastern cities such as New York and Boston, was able to offset those losses through immigration. In 2014, 13 percent of Philadelphia residents were people who had been born in another country, up from 9 percent in 2000, according to census data cited by Berube. The city’s Asian and Latino populations have boomed. And the city’s mayor has made it a sanctuary for undocumented immigrants, though it’s unclear what effect that has had on overall immigration numbers. As a result, Philadelphia’s total population has risen by nearly 80,000 since 2006.

Cleveland hasn’t become a major destination for immigrants, like many other Midwest cities, where immigrants face the challenge of entering mostly white, native-born communities. (Notably, Chicago, Minneapolis and Detroit have attracted many immigrants.) Just 5 percent of Cleveland’s population was foreign-born in 2015, up from 4.5 percent in 2000, and in absolute terms, their numbers fell, just not as fast as those of the native-born population. The city has lost another 8 percent of its population since 2006.

Philadelphia is still struggling by many measures. It has the highest rate of poverty among cities with at least 1 million people, according to census data analyzed by Brookings and cited in an article about the two cities in The New York Times. But despite a revival of the city’s core, Cleveland faces even deeper challenges than Philadelphia. Its poverty rate is much higher — 39 percent to 26 percent in Philadelphia.

Demographers expect the two cities to stay on their diverging tracks. The Urban Institute projects that the Cleveland area will lose 4 percent of its population from 2010 to 2030, while greater Philadelphia is expected to add 7 percent to its population, assuming average births, deaths and migration. In the best-case scenario considered by the institute — high birth rate, low death rate, low migration — greater Cleveland’s population would rise 13 percent from 2010 to 2030, still leaving it well below the city’s heyday.

CORRECTION (July 29, 6:25 p.m.): An earlier version of a chart in this article used incorrect data, supplied by the Urban Institute, for per capita income in Philadelphia and Cleveland from 1980 to 2010. The data was not adjusted for inflation, though the chart said it was. The chart has been updated to show per capita income in the two cities in 2012 dollars.