DHAKA, Bangladesh — The future is here, and it smells like burning trash.

As the evening call to prayer echoes across Dhaka’s teeming slums, a bluish haze rises in the murky air. Cooking happens mostly on open fires in the shantytowns of the Bangladeshi capital, the flames kindled with paper, scavenged lumber and bits of plastic junk.

On a recent evening in a broken labyrinth of shacks called the Korail slum, a wiry young mother in a red sari stooped to light the clay hearth outside her family’s one-room home. Mina, 24, touched her match to a castoff vinyl folder, three-hole-punched for documents she’ll never read.

“I don’t like to live in Dhaka,” she said, fanning the smoking plastic, then laying splintered bamboo on top. “But we have a dream to buy a piece of land, some land back in our village.”

Mina, who uses only one name, followed her husband here in 2009 — joining the nearly half-million migrants who pour into Dhaka each year. It’s not clear how soon, if ever, they’ll leave. Mina’s husband saves only a few dollars each month from his job selling fish. Mina, meanwhile, cares for their two children and, like millions of other women here, fires up the family’s nightly meal.

The smoke from these fires signals not a return to a prior age but, rather, the dawn of something new. Depending on how one measures, the planet now boasts 20 or so megacities — urban agglomerations where the United Nations estimates the population has reached 10 million or more. The world’s rapid urbanization is a reality fraught with both peril and hope. The peril is obvious. Overcrowding, pollution, poverty, impossible demands for energy and water all result in an overwhelming sense these megacities will simply collapse. But the hope, while less obvious, needs more attention. The potential efficiencies of urban living, the access to health care and jobs, along with plummeting urban birth rates have all convinced some environmental theorists the migration to cities may in fact save the planet. But only, these experts hasten to add, if this shift is well managed.

Among these megacities, The World Bank says Dhaka, with its current population of 15 million people, bears the distinction of being the fastest-growing in the world. Between 1990 and 2005, the city doubled in size — from 6 to 12 million. By 2025, the U.N. predicts Dhaka will be home to more than 20 million people — larger than Mexico City, Beijing or Shanghai.

Mass migration, booming populations and globalized trade are swelling cities worldwide, but these forces are perhaps more powerfully concentrated in Dhaka than anywhere on earth — offering a unique window on an urban planet soon to come.

“You are seeing the early future of the world, which is not a very pleasant thought,” said Atiq Rahman, a Dhaka climate and migration researcher who heads the Bangladesh Centre for Advanced Studies. Explosive growth in cities like Dhaka, he said, has created “a cluster of demographic chaos.”

The earth’s countryside is emptying out, more quickly all the time. It took about 10,000 years for the human population to become 3 percent urban — a period extending roughly from the dawn of human settlement until 1800. A century later, Earth was still just 14 percent urban. But in 2007, the United Nations announced we’d crossed a monumental threshold. For the first time, more than 50 percent of the world lived in cities rather than rural villages and farms. By 2030, some projections say more than 80 percent of humanity will be urban, with many inhabiting the slum-choked cities of the developing world.

The shift is “a watershed in human history, comparable to the Neolithic or Industrial revolutions,” urban theorist Mike Davis wrote in his book “Planet of Slums.”

In the simplest sense, this transformation has a dual cause: Masses of migrants are abandoning the countryside, and they keep having babies after coming to town. By some accounts, fertility is a larger slice of the pie.

“It’s roughly a 40/60 split,” said Deborah Balk, an urbanization specialist with the CUNY Institute for Demographic Research in New York City. “We have more large concentrations of people than we’ve ever had before. That is new. And those concentrations themselves, they have momentum.”

As many as half of the newcomers worldwide will end up in medium-sized cities with populations of up to half a million people, by the U.N.’s count. But many migrants will make their home in a growing number of megacities — urban giants such as the world has never seen.

By 2025 the U.N. predicts that Delhi, Dhaka, Kolkata, Mumbai, Mexico City, New York, Sao Paulo and Shanghai will all have populations of more than 20 million. Tokyo is projected to become home to some 37 million — three times the current population of Greece.

A few of the elder giants — New York, Tokyo, Paris — grew huge under the influence of forces that helped give birth to modernity itself: the rise of nation states, manufacturing and mass domestic markets.

“The old cities developed out of industrialization,” Balk said. “But you don’t see that happening now.”

Many new cities are getting big without growing rich. Megacities like Lagos, Nigeria; Karachi, Pakistan; and Kinshasa, in the Democratic Republic of Congo, barely registered on the world stage at mid-century. The millions inhabiting each city now still survive largely off the financial grid.

“These are poor cities, and that divide is really important,” Balk said. “There was poverty in London, New York, and Paris and Tokyo 100 years ago — and there still is poverty in some of those cities — but they never had slums in the way you see in today’s contemporary poor cities.”

Among these slum cities, Dhaka represents an extreme case. The Bangladesh Centre for Advanced Studies estimates that as much as half of Dhaka’s population lives in the vast, hand-built shantytowns that grow here like kudzu on any open patch of ground — beside rail lines, along riverbanks and in swampy lowlands shadowed by high-rise hotels.

“The megacity of the poor,” is how the urban geographer Nazrul Islam describes his hometown. He estimates that about 70 percent of Dhaka’s households earn less than $170 per month. The bottom 40 percent take home less than half that, he said. Most of the migrants come betting life in Dhaka will beat life in the village. Unlike in China, which places stiff restrictions on internal migration, it’s a choice Bangladeshis are free to make.

“There has been no restriction on city-ward migration,” Islam said. “Whenever there is a disaster, people tend to move.”

As a growing number of researchers worry that climate and environmental shocks will spur mass migration worldwide, ecologically-fragile Bangladesh may offer a taste of what’s in store. Each season, cyclones, floods and creeping sea-level rise drive thousands of Bangladeshis from their villages.

“The country is always facing some disaster,” said Ranajit Das, an aid worker who has spent his career in Dhaka’s slums. “Every year.”

The displaced have few options. This river-delta nation sits wedged between India and Myanmar and it remains one of the most densely settled countries on Earth. Bangladesh’s population of 150 million people — about half the United States — is crammed into an area smaller than the state of Iowa. The country has but one administrative and economic center. For Bangladeshis on the move, Islam said, “their first destination is the large city, Dhaka.”

While a third of the newcomers see their incomes fall after arriving in the slums, Islam’s research suggests that over time, the majority hold steady or see their wages rise. “For some people it is a trap,” he said. “But for many people it’s also a platform to move up economically and also socially.”

Some researchers say there are also sound ecological reasons to welcome the dawn of an urban planet. To start with, a planet of cities could avert a scenario where an ever-rising human population is doomed to fight over ever-dwindling resources.

Here’s why: As countries urbanize, birthrates tend to decline. In most industrialized, urban countries, birthrates consistently remain at or below replacement levels, defined as 2.1 children per couple.

The incentives behind the trend are simple, argues Phillip Longman in his 2004 book, “The Empty Cradle.” Rural families need large numbers of children to help raise crops and livestock. But in a city high-rise or crowed slum, there is little or no economic incentive to have children. In fact, for women considering childbearing versus working, the incentives are reversed. The world’s cities are still growing in absolute terms but, as the pool of potential mothers shrinks, population growth will slow and, finally, fall.

“If this seems counterintuitive, think of a train accelerating up a hill,” Longman writes. “If the engine stalls, the train will still move forward for a while, but its loss of momentum implies that it will soon be moving backwards, and at even greater speed.”

Regardless of present birthrates in third-world slums, Longman says the migrants will soon submit to the same pressures that are driving fertility down everywhere else. Urbanization is among the factors the U.N. cites when predicting that Earth’s population will eventually level off around 9 billion.

The trend has led environmental theorists like Stewart Brand to declare that third-world urbanization has “defused the population bomb.”

“The Whole Earth Catalogue” co-founder said the mass shift from rural village to urban slum is good for the planet in other ways, too. Cities — even slum cities — use energy more efficiently than villages do, Brand says, and leaving villages behind helps blunt the environmental devastation wrought by subsistence farming.

“There’s a hell of a lot of landscape growing back. Ecologically that’s great and in terms of climate that’s great,” Brand said.

Rather than fighting informal communities, Brand says governments ought to embrace them, and give slum-dwellers better security, connect them to utility grids and encourage entrepreneurs.

“The old thinking is that slums were the problem,” Brand said. “The new way of thinking is they’re the solution.”