In the empty desert, workers are building an answer to a difficult question: What should Israel, a nation built by Jewish refugees, do about the 55,000 African migrants who entered this country illegally, fleeing famine, bondage and war?

The newly constructed “open facility” is designed to hold up to 3,300 illegal immigrants. It is not a prison, but not exactly a shelter, either. Residents will be required to answer roll call three times a day. They are not allowed to seek work. The facility is surrounded by a fence topped with spools of razor wire, and the migrants will be locked down at night.

The Israelis do not want to forcibly deport the “infiltrators,” as they are called here. Nor do they want them to stay. The country is looking for ways to push the Africans to leave voluntarily, and the detention facility is one way to give them a shove.

The struggle over what to do with the asylum seekers, refugees and others who entered the country illegally parallels similar debates in Europe and the United States. But in Israel, the issue is further complicated by religion.

As a Jewish state, the country welcomes Jews from around the globe who would like to move here, providing generous subsidies and language training to ease their way. Israel absorbed tens of thousands of Jews from Ethiopia over the past three decades, spending billions to integrate people who had been living an agrarian lifestyle into this fast-paced, high-tech society.

But the Africans who have poured into Israel in recent years are Muslim and Christian. They arrived in a land already engulfed in a struggle between two peoples, Arabs and Jews. Israel is especially attractive to migrants from Eritrea, Sudan and other African countries, officials here say, because Israel is the only Western-style democracy with a thriving economy that Africans can reach on foot. Prime Minister Benjamin Netanyahu has warned that the influx could imperil Israel’s ability to remain both a Jewish and a democratic state.

“There are currently around 30 million people moving around Africa, people who have left their home countries and are looking for a place to be,” Interior Minister Gideon Sa’ar said at a hearing in the Knesset, Israel’s parliament. “We can all understand that pressure, but if we are too liberal, then we will lose the country. We will lose the only Jewish country that exists.”

Legislation that would have allowed illegal migrants to be held up to three years in detention centers was struck down in September by Israel’s Supreme Court. In response, lawmakers this month passed a law that calls for one-year detentions in the open facilities and other punitive measures. It, too, is being challenged in court. The cabinet also approved increasing, from $1,500 to $3,500, what Israel is willing to pay illegal migrants who leave voluntarily. But it is not clear where the migrants should go.

The government is seeking third-party countries in Africa to accept them, and negotiations with Uganda are ongoing, according to Israeli news media.

The Israeli government has not explained exactly who will be sent to the new facility in Ktsiot, except to say its first residents will be men who have been in Israel in the longest. Critics say that a facility designed to hold fewer than 10 percent of the illegal migrants already here will not solve the problem. Supporters say it is a first phase, a necessary deterrent that will show the Africans there is no permanent home for them in Israel.

Several hundred of the first migrants sent to the facility have fled, marching across the desert to Jerusalem and Tel Aviv in protest. They demanded either asylum or to be turned over to an international refugee agency. Scores were arrested, and many now face prison time.

About 90 percent of Israel’s African migrants come from Eritrea and Sudan, including the Darfur region, areas beset by genocide and humanitarian crisis. Dawit Demoz, an Eritrean, crossed the border illegally after a year-long journey, aided by smugglers, through Ethiopia, Libya and Egypt. He said he was fleeing his country’s mandatory military conscription, which he compared to modern-day slavery.

“I am not trying to escape to Israel,” Demoz said. “I am trying to find freedom,”

Between 2005 and 2012, African migrants came in a trickle, then a flood, pouring across Israel’s border with Egypt, with a peak of 17,258 in 2011.

Most waited quietly after crossing the border to be detained by Israeli army patrols. They were housed for a few weeks or a few months in a detention facility, then given a bus ticket to Tel Aviv. There, they received an identification card and, eventually, a deportation order, which was not enforced because the government did not want to forcibly send them home. Many found off-the-books jobs as cooks, dishwashers and hotel maids.

In 2012, Israel built a high-tech fence along the border with Egypt, bristling with cameras, radar and sensors. Illegal migration from the Sinai essentially ended. From January to July of this year, only 36 Africans got through. Since then, there have been months when no migrants crossed the border. But the question of what to do with those already here remains.

Tens of thousands of illegal migrants live in crowded apartments in south Tel Aviv, where the streets are filled at night with African men visiting barbershops, eating at Sudanese restaurants and sleeping in the parks. Israelis complain of new problems with crime and poverty. At a rally last year, lawmaker Miri Regev called the migrants “a cancer in the body” of the nation. She later apologized. But a poll taken by the Israel Democracy Institute found that 52 percent of Israelis agreed with her.

At a hearing on the new immigration law, an elderly resident of south Tel Aviv shouted that life had become unbearable for her and her neighbors. They are terrified to leave their homes, she said. Deportation, in her mind, is the only solution.

Human rights advocates say Israel needs to overhaul its asylum system and give every refugee who seeks asylum a forum to present his or her claim. In the meantime, the migrants should get work permits, said Sara Robinson, of Amnesty International Israel.

“The Israeli government has already agreed it will not forcibly deport Eritreans and Sudanese,” Robinson said. “So if they are staying here for the near future, then they need to be given the rights that go along with it.”

An editorial in the liberal newspaper Haaretz argued that “the ‘infiltrators’ are first and foremost human beings, who want to live normal lives. Most of them are refugees who deserve Israel’s protection. But Israel, which should provide them with this protection, is abandoning its responsibility to do so.”

The migrants say they are living in confusion and fear. Tekle Ghebvehiwot, an Eritrean who manages a little sundries shop in south Tel Aviv, worries about being arrested.

Adda Ahmed, who runs a computer repair shop, wondered why Africans are treated so differently from the legal foreign workers in Israel — the Filipinos who care for the elderly, the Thais who pick citrus, the Chinese who erect skyscrapers. “Africans do all the jobs that the Israelis don’t want to do,” Ahmed said. “Why not let us stay, at least for a while longer?”

But the non-African immigrants come with legal work permits and employment contracts. They stay in Israel for a set period of time and then go home.

Ahmed has no home to return to. A picture of his village in Darfur hangs on the wall of his shop. But no one lives there anymore. It was one of the more than 3,000 villages damaged or destroyed in fighting between government forces and rebel groups.