MIAOMIAO LAKE VILLAGE, China — Ankle-deep sand blocked the door of their new home. Pushing bicycles through the yard was like wading in a bog. The “lake” part of Miaomiao Lake Village turned out to be nothing but a tiny oasis more than a mile from the cookie-cutter rows of small concrete-block houses.

Ma Shiliang, a village doctor whose family was among some 7,000 Hui Muslims whom the Chinese government had brought to this place from their water-scarce lands in the country’s northwest, said officials promised “we would get rich.” Instead, these people who once herded sheep and goats over expansive hills now feel like penned-in animals, listless and uncertain of their future.

“If we had known what it was like, we wouldn’t have moved here,” said Dr. Ma, 41, who, three years on, has been unable to get a job practicing medicine in Miaomiao Lake Village or to find other reliable work.

China calls them “ecological migrants”: 329,000 people whom the government had relocated from lands distressed by climate change, industrialization, poor policies and human activity to 161 hastily built villages. They were the fifth wave in an environmental and poverty alleviation program that has resettled 1.14 million residents of the Ningxia Hui Autonomous Region, a territory of dunes and mosques and camels along the ancient Silk Road.

Han Jinlong, the deputy director of migration under Ningxia’s Poverty Alleviation and Development Office, said that although the earlier waves were not explicitly labeled ecological migrants, they had also been moved because of the growing harshness of the desert. It is the world’s largest environmental migration project.

What China is doing in Ningxia and a few other provinces hit hard by drought and other natural and man-made disasters is a harbinger of actions that governments around the globe, including the United States, could take as they grapple with climate change, which is expected to displace millions of people in the coming decades.

China has been battered by relentless degradation of the land and worsening weather patterns, including the northern drought. But mass resettlement has brought its own profound problems, embodied in the struggles of the Ma family and their neighbors.

Dr. Ma told me over tea in his living room that each household had to pay a $2,100 “resettlement fee” and was promised a plot of land to farm as the families left behind plentiful fields and animals. But those who received plots ended up having to lease them to an agriculture company, and were left with tiny front yards, where the Mas grow a few chili plants.

The 11-member family was expected to squeeze into a 580-square-foot, two-bedroom home; like many of the migrants, Dr. Ma erected an extra room with white plastic siding in the yard for his parents.

And the officials designing the new homes put toilets in the same room as showers, an affront to the Hui Muslims. Dr. Ma dug a pit toilet outside, where the front yard meets the road.

Dr. Ma has not only been unable to get officials to appoint him as a village doctor here, but since November has also failed to find construction work — unstable and low-paying, but the most common job for the village men. The family must live mainly off the $12 per day his wife, Wang Mei, earns in an industrial farm field.

Together with Dr. Ma, three of Dr. Ma’s brothers and a nephew brought a total of 38 family members as part of the resettlement. But another brother, Ma Shixiong, was one of a handful who stayed behind in Yejiahe village, a five-hour drive south, defying the government’s orders. Officials tore down the homes of the families who left — and punished those who remained by refusing to renovate their houses or build them animal pens, and denying them water pipelines and subsidies for raising sheep and cattle.

Wang Lin, who is also unemployed and was one of eight men I spoke to one afternoon following prayers at Miaomiao Lake’s Ji’an Mosque, said he and eight family members planned to return to Yejiahe next year if he did not find a job.

“No one has moved back yet, but people are talking about it,” said Mr. Wang, 48.“We can farm the land there. Our homes are no longer there, but we can dig into the earth and build a cave home.”

‘It is all the responsibility of the government.’

As in much of northern China, most of Ningxia’s 26,000 square miles are desert, including the areas chosen for resettlement. Government officials say places like Miaomiao Lake are still an improvement over Xihaigu — the vast region of southern and central Ningxia where the Mas and the other migrants came from — because they are closer to highways; to Yinchuan, Ningxia’s capital; and to the Yellow River, a major water source that helped give birth to Chinese civilization.

An aerial view of Yejiahe, the village from which Ma Shiliang and his family were relocated.

When Prime Minister Li Keqiang visited Ningxia in February, he told villagers that “relocating impoverished people from bad natural conditions is an important way to alleviate poverty,” according to the website of the State Council, China’s cabinet.

A third of Ningxia’s population — and most of the people who have been resettled — are Hui Muslim. Some Western scholars say that Chinese resettlement policies are at least partly aimed at controlling ethnic minority populations, and that officials may cite environmental reasons as a cover.

Though remote, the parched Xihaigu area has been on the radar of the central government since at least the 1980s, when officials began producing a series of grim reports on the viability of the land. A recent estimate by researchers from the Chinese Academy of Sciences and the Ministry of Land and Resources said the region could sustain only 1.3 million people; the population in 2014 was about 2.3 million.

“The government decided to move people out because the land couldn’t feed them,” Zhang Jizhong, the deputy director of the Ningxia Poverty Alleviation and Development Office, told me when I met with him and his colleague Mr. Han in their Yinchuan office in August. “The factors are rooted in history, nature and society.”

Rainfall was increasingly rare. Villagers had cut down many trees for firewood and to build homes, he said. And the government never built enough reservoirs.

Across Ningxia, the average temperature has risen by 2.1 degrees Celsius, or 3.8 degrees Fahrenheit, in the last 50 years, more than half of that increase occurring from 2001 to 2010, according to a book by Ma Zhongyu, a former senior official, citing data from an international study. Annual precipitation has dropped about 5.7 millimeters, or about a quarter inch, every decade since the 1960s.

Mr. Zhang said a main goal of moving people from Xihaigu was to turn the hills green, with a parallel planting program. More than two million acres have been converted to forest and pasture land, he said, citing the Guyuan area, where forest coverage was 22 percent last year, up from 4 percent in the 1980s.

“There are more wild animals and vegetables there now,” Mr. Zhang said of Xihaigu. “When we go there, we can sometimes eat wild chicken.”

When the resettlement program was begun in 1983, migrants were given land in the north and told to move and build new homes on their own. These days, the government builds them homes, albeit small ones; of the $3 billion spent on the five waves of relocation, Mr. Zhang said, half was used on the most recent one.

“Houses need to be built well, roads need to be built well, schools need to be built well,” he said. “It is all the responsibility of the government.”

The relocation process begins with the government asking geological experts to look for sufficient arable land elsewhere in Ningxia, Mr. Zhang said, then gauging whether enough water can be transferred to those places.

The size of each family’s yard plot is about 150 square meters, or 1,600 square feet, with the house taking up a third of that. Many complain about the cramped quarters and the additional one mu of farmland — a sixth of an acre — that each person is allotted in most cases, far less than they had in their home villages.

“Land and water are indeed becoming more scarce in the north,” Mr. Zhang acknowledged. In the last wave of relocations, a quarter of the families did not get any land, he said, adding that the government had labeled them “labor migrants” and was negotiating with companies to give them city jobs, including as cleaners and security guards.

But officials know that even those who get farmland face a struggle.

“That is far from enough to get you out of poverty,” Mr. Zhang said. “It can maybe feed you. The government has been making lots of efforts to get people to be able to work in other sectors, so you don’t rely on land itself for a living.”

‘I never worked like this before.’

The largest of Ningxia’s new migrant villages, Binhe Homeland, has more than 16,000 residents. The smallest have just a few hundred each. Miaomiao Lake is in the middle, with 7,000.

The 1,400 homes there look bland and anonymous, separated by low concrete walls, with only numbers to distinguish them: Dr. Ma’s is House 35 in District 5. Most villages have an elementary school, a market area and mosques, but seem more like refugee camps than organic communities.

One afternoon during one of my three recent visits to the region, Ms. Wang, Dr. Ma’s wife, came home from the farm to nap during her lunch break. She had been up since dawn spreading fertilizer over a field of watermelons.

After a half-hour’s sleep, it was time to return to the desert sun.

She said goodbye to Dr. Ma and their younger children, clad in red-and-white school uniforms. Then she drove an electric cart to a highway, where dozens of other women in electric carts were gathering. Most wore pink head scarves, a shock of color against the sand that stretched to the horizon.

MONGOLIA NORTH KOREA Beijing Hohhot Seoul SOUTH KOREA GOBI Taiyuan Yinchuan NINGXIA Yejiahe Xi’an Shanghai CHINA Chengdu 250 Miles MONGOLIA Hohhot GOBI Yinchuan Taiyuan NINGXIA Yejiahe Xi’an CHINA 250 Miles

The women clambered onto the flatbeds of two John Deere tractors, which drove off to the watermelon field.

“The work is so exhausting, and I’m dead tired,” said Ms. Wang, 39. “I never worked like this before, when we were living in the south. I farmed our own land there, and we lived our days according to our own schedule.”

Before the move, Ms. Wang imagined that the family would grow food on its own patch of farmland, to eat and sell, as it had done in Yejiahe. But officials decided that the villagers would be better off leasing the plots — a total of 3,300 acres — to a large company, Huatainong Agriculture, and other enterprises because the desert land was hard to farm.

“New immigrants don’t really know how to plant crops on the land,” explained Wang Zhigang, the director of the Pingluo County poverty alleviation office, adding that migrant families had tried and failed.

Each family member is supposed to receive 195 renminbi per year, or $29, for leasing their land. Mr. Wang said the money is deposited annually in a family bank account, but Dr. Ma said his household had not received the payment after the first year.

So the family’s only steady income is the $12 a day Ms. Wang is paid by Huatainong — less than the $15 per day that China says is the average for migrant workers.

Like many in Miaomiao Lake, Dr. Ma has taken out government loans to help meet the family’s living expenses.

‘You can’t just make me a coal-mine worker now.’

Dr. Ma learned how to give shots years ago, after watching an older brother whose son got sick frequently. When the village of Yejiahe needed a doctor, that gave him a leg up. His formal education had stopped before high school, but he studied medical techniques on his own. He received his medical license in 2011. He mostly administered vaccines and treated colds and other minor illnesses.

But Dr. Ma said he could not get a job as a doctor in Miaomiao Lake because the government had created only one such post there, which he considered absurd for a village of 7,000. He said that he had repeatedly asked the county health department to add a position for him, but that an official had told him the decision could be made only at a higher level. (A county health official said in an interview that there were plans to add two doctors to Miaomiao Lake.)

Still, friends sometimes ask Dr. Ma to administer a shot. In return, he sometimes asks for the equivalent of $1.50.

One afternoon, a fellow worshiper from Ji’an Mosque came to Dr. Ma’s home for an intravenous drip of calcium gluconate, a mineral supplement. The man lay on a bed by the front window and held out his right arm. The doctor worked with precision — and without charge.

It is difficult to get a handle on employment in Miaomiao Lake. Mr. Wang, the Pingluo County official, said of the 2,000 ecological migrants in the village who had “the ability to work,” 93 percent had jobs. A senior executive at Huatainong said the company employed 400 to 500 women for half the year, and about 100 at other times. Dr. Ma and many others disputed the official employment figures, saying that most men could not find regular work on construction projects in the new villages or nearby cities.

Once each year, residents said, government officials have offered training sessions of one to two hours to teach villagers how to become welders or bricklayers. “Useless,” Dr. Ma said. “There aren’t many jobs available.”

City-level officials visited the village for a day in May; Dr. Ma said one offered him a job in a coal-washing factory in a city, but he “didn’t want to go because the lifestyle there is different than ours,” with few Hui Muslims and many ethnic Han.

There was also the matter of pride. “I’ve been a village doctor,” he said. “You can’t just make me a coal-mine worker now. It’s not appropriate.”

Unable or unwilling to do manual or farm work, some of the migrants run restaurants, pharmacies or other small businesses. Near the front archway of the village is a plaza lined with storefronts, but most were shuttered the morning I visited. No one was renting them.

I found Ma Nüwa in the only open shop along one row. She had been selling blankets there for more than two years, and said she made about $75 per month.

“Business is bad; there are no people here,” she said. “I have three boys. My husband has to go outside to find manual labor.”

Some out-of-work men retreat to the mosques, where five daily prayers give life some structure. Sometimes before going to pray, Dr. Ma showers, puts on a crisp white shirt and fixes his skullcap just right, adjusting it in the mirror.

At his home, there are always children around. The parents took the youngest daughter, Shuyun, out of preschool because they could not afford the $150 fee each semester. The oldest, 16-year-old Xiaofang, had been enrolled in a boarding school, but stopped after a year and a half.

“I don’t like school, and I don’t want to go back,” she told me one day as she cooked noodles for the family for lunch. “I plan to go to Yinchuan after Ramadan to find work.”

But Dr. Ma said: “My oldest daughter isn’t going to Yinchuan. She’s too young.”

‘It’s not a very civil lifestyle.’

The road to the Mas’ old village, Yejiahe, winds uphill past a reservoir, past hills covered with soft yellow silt, past horses and haystacks in people’s yards. The landscape is wide and rolling and green, nothing like Miaomiao Lake.

We parked atop a ridge overlooking a valley. Dr. Ma’s brother Ma Shixiong greeted me at the side of the road, dressed in a blue tunic and skullcap. His face had as many creases as the hills.

He was the man who stayed behind, even as his extended clan, including his elderly parents, had migrated northward. His wife, three of his sons and four grandchildren also remained in Yejiahe; two other sons worked at a restaurant in Beijing. About 300 villagers remained from a population of about 1,400 in the late 1990s.

He handed me a cup of tea in a front room with a brick floor and mud walls that, even in the summer heat, stayed cool.

“We didn’t have any plans to move out there,” Mr. Ma, 50, said of Miaomiao Lake. “We knew we would only be given one house.”

He told me many Yejiahe families had a long history of being relocated at the whims of government officials. His ancestors lived in south-central Ningxia, near the Yellow River, “a very easy place to live,” he said. More than 100 years ago, officials under the Qing court ordered the family to move to Yejiahe.

Decades ago, Communist officials divided the village into five teams. The Mas were in one called Xiahe. A few years ago, officials told the Xiahe families they had to relocate to the north. Fifty households moved; nine refused.

Why some chose to stay, even at the cost of fracturing extended families, became clear once Mr. Ma walked me through his home.

Compared with his brother’s place in Miaomiao Lake, it might as well have been an imperial palace. Two rows of rooms face a large courtyard. The families of two of his sons, each with two children, have their own quarters. The total area is 300 square meters — 3,229 square feet, twice the size of the housing plots in the new village.

Mr. Ma said he had visited his family a half-dozen times in Miaomiao Lake, before their ailing father died in February 2015.

“When I first saw that place — that little yard and the little house and the little bathroom in front of the door…” he said, trailing off. “The hygiene is not good. It’s not a very civil lifestyle.”

“You don’t have land, and you need to go out to find jobs,” he added. “How can you make a living?”

In Yejiahe, Mr. Ma had up to eight acres of land to farm, though occasional floods had destroyed some fields. Behind his home was a large field of corn and oats. The family sold those crops as well as potatoes and millet. In front of the house, a donkey stood in a pen.

The family drew water from a well in the back, as villagers had done for generations. The people who moved to Miaomiao Lake had been relieved to finally get running water. Then they heard that soon after they moved, pipelines for tap water had been installed for much of their former village.

But not for the Xiahe team members who defied the government relocation order. It was as if they were phantom households, Mr. Ma said, wiped from existence.

As we talked, neighbors began crowding into the front room. They had heard that a reporter from Beijing was in town. Each wanted to voice a complaint about local corruption. “It’s a primitive society here because no one cares about us,” Mr. Ma said.

The day was fading, and Mr. Ma led me outside to see his brothers’ old homes. We climbed up a hill, and the wide valley stretched out in front of us. Mr. Ma and his neighbors said the area had been drying up for years; there was less rain than a decade ago.

But I could see patches of vegetation on the hills. Since the Xiahe team left, trees and shrubs had begun to reappear, Mr. Ma said. Fewer people meant less stress on the land.

We reached a rise above the valley. In front of me was what remained of the mud-wall home where Dr. Ma and Ms. Wang had begun raising seven children. Officials had it knocked down, leaving blocks of earth and crumbling walls in the dirt.

For Ma Shixiong, the memory of his four brothers’ departure in November 2013 was as clear as the sky overhead. The families had loaded their furniture onto trucks. They had boarded a bus the next morning.

“We all cried,” Mr. Ma said. “They cried, I cried. We were a family, and now we’re separated. I hope they will move back, but it’s impossible.”

We walked back down the ridge. The afternoon shadows were lengthening, and the homes on the hill stood silent in their ruin.