Just a few months ago, Israel was in the midst of a nationwide uproar over the tens of thousands of African migrants who have poured into the Jewish state. Today, that influx has slowed dramatically, following a series of measures meant to halt the new arrivals.

The quick results are testament to a get-tough approach that has included the rapid construction of a soon-to-be-completed fence along the border with Egypt's Sinai peninsula, and a new policy of detaining Africans upon arrival.

But the strategy has come with a price: Advocacy groups accuse Israel of violating international refugee law by cooperating with Egyptian security personnel to round up migrants on the border. They also say more than a thousand Africans are now languishing in mass detention centers set up to hold them.

Israeli military spokeswoman Lt. Col. Avital Leibovich said she had no immediate information on whether Israeli and Egyptian forces were cooperating in rounding up migrants. Government spokesman Mark Regev had no comment when asked if Israel was carrying out this practice.

Israel, which contends that most of the Africans are not bona fide refugees and are merely looking for work, still has no answer for what to do with the roughly 60,000 Africans living in limbo in city slums.

Danny Danon, who heads a group of lawmakers pushing to expel all unauthorized migrants, credits the border fence and a new policy of long-term detention that makes it impossible for migrants to work and send money back home.

"I think Israeli society woke up, albeit too late," said Danon, a member of the governing Likud Party. "But (now) there is an understanding that while we're a Jewish state sensitive to refugees, we cannot become a safe haven for hundreds of thousands of Africans who want to improve their quality of life."

The influx of Africans over the past seven years has ignited a debate over whether Israel's role as a sanctuary for Jews after the Holocaust obligates it to open its doors to others escaping misery and persecution. But as the number of Africans has grown, some Israelis have said the country's Jewish character could be threatened by the migrants. That, and a series of crimes blamed on the Africans, has led to a harsh, sometimes violent backlash.

Migrants have been attacked in several cases and politicians have called them criminals, a "national scourge" and "a cancer in our body."

Israel is far from alone in its dilemma: European countries have sought to prevent tens of thousands of people from reaching the continent by boat from Africa and have started implementing a range of border control measures on land and on the high seas. Italy generally puts them into holding centers, then they are sent home if there is no case for political asylum. In Greece, detention camps have been established similar to those built in Israel. In 2011, at least 1,500 people, including women and children, drowned in the Mediterranean Sea trying to reach Europe, according to a recent report by Amnesty International.

Legally, Israel cannot deport most of the migrants because the overwhelming majority — some 85 percent — come from Sudan, an enemy state, and Eritrea, repressive regimes with miserable human rights records. As a signatory to an international treaty on refugees, Israel cannot forcibly return people to countries where they face persecution.

Still, the migrants' swelling numbers and public sentiment against them propelled the government to start clamping down. In June, it began forcing out citizens of South Sudan, a state that has friendly relations with Israel, offering them cash to leave and threatening to detain them if they didn't depart. Most of the original total of 2,000 left, the Interior Ministry says.

The government's main effort, however, has been focused on keeping more unsanctioned migrants from entering. In June, it began enforcing a recently amended law that lets authorities detain migrants for three years and in some cases, indefinitely.

At the same time, the government is expanding its detention facilities and rushing to complete within months a 240-kilometer (150-mile) fence along the border with Egypt meant to keep out both Africans and Islamic militants.

It may be premature to declare a trend, but the Interior Ministry, which oversees traffic in and out of Israel, says after a long stretch when 1,000 and more migrants would enter monthly, the number fell to 268 in July and 191 for the first three weeks of August.

The expansion of the main detention center in southern Israel allows authorities to detain migrants longer because in the past, they generally had to release them after a matter of days because of a lack of space, ministry spokeswoman Sabine Haddad said. The facility's capacity has nearly tripled to accommodate 5,400 people, and expansion is planned to hold an additional 20,000. Some 1,700 migrants are currently in detention, the prisons service said. It rejected a request by The Associated Press to visit the facility.

Advocates for migrants say they have been denied access to the Africans in custody and have petitioned Israel's Supreme Court to lift the restrictions.

The envoy for the U.N. High Commissioner for Refugees, William Tall, says the conditions are acceptable for a short-term stay but deplored the legal amendment allowing long-term detention without access to formal asylum-seeking procedures.

"The law is meant to detain people and send a deterrent message: Israel is no longer a welcoming country," he said.

Tall said he said he had no indication yet from colleagues in Eritrea and Sudan whether the clampdown was having an impact. But he said word of recent attacks by Israelis on migrants and migrant homes and businesses "has clearly filtered out to African states."

Instability in Egypt's Sinai desert, where the Egyptian government has launched an offensive against Islamist militants, might also be a factor in the declining number of arrivals, he added.

Sigal Rozen of the Hotline for Migrant Workers, an advocacy group that helps the Africans, says the government is misleading the public into thinking the fence and detention are the main reasons the flow has slowed.

According to testimony gathered by her group from three soldiers, Israeli troops are not letting migrants in and are telephoning Egyptian security personnel to pick them up, she said.

"Israeli soldiers threaten them with weapons and call the Egyptians to take them," Rozen said. "The (Israeli) politicians say it's not being done. But on the ground, soldiers are doing it."

The soldiers' testimony could not be confirmed.

But Egypt reported it apprehended more than 500 migrants in July, a sharp uptick of several hundred from the monthly average.

Denying the migrants entry to Israel and turning them over to Egyptian security violates international refugee law and Israeli law because the Egyptians are liable to return them to their countries of origin, where their lives would be in danger, Rozen said.