Updated

Palestinian security forces sealed off Gaza's southern border early Sunday, officials said, halting a chaotic flood of people into Egypt (search) following the Israeli withdrawal from the area.

Palestinian leader Mahmoud Abbas (search) said the border is under control after days of chaos.

Adnan Barbach, a spokesman for the Palestinian National Security Forces, said all the gaps in the border were closed, and 2,000 security personnel were now deployed along the border. He said the Palestinians were working with Egypt to make sure that people stranded on each sides of the border could return home.

"The chaos that existed here is over," Abbas said following a tour of the area.

The border mayhem was a key test for Abbas, who is under heavy Israeli pressure to control Gaza.

Security along the border broke down last week almost immediately after Israel completed its pullout from Gaza. With the Israelis gone, thousands of Palestinians streamed over the border into Egypt.

Although most people traveled to shop, celebrate or reunite with relatives, Palestinian officials said drugs and weapons were smuggled into Gaza.

Palestinian police patrolled the border early Sunday and prevented people from crossing. With breaches in the border wall sealed, angry Palestinians were forced to turn back, threatening to return with Hamas militants and homemade rockets.

Several hundred people, mostly Egyptians, lined up at the Rafah border terminal, where forces checked identifications and allowed people to return home. Palestinians were not allowed to cross into Egypt.

Jamal Kaed, the Palestinian commander for southern Gaza, said he expected the border to be reopened within 48 hours but declined to elaborate.

Under an agreement with Egypt, Israel ordered the Rafah crossing closed indefinitely before withdrawing, saying it would consider letting the Palestinians open it in six months if Abbas brought order to Gaza.

The border dispute put Abbas in a difficult situation. With legislative elections scheduled for January, Abbas needs to secure freedom of movement for his people or risk losing support to the rival Hamas movement.

But the chaos along the border makes him look weak internationally and will make it tougher to negotiate a future border deal with Israel.

Israel fears militants will smuggle advanced weaponry into Gaza for use in future attacks against it. In the meantime, all traffic in and out of Gaza is to be rerouted through alternate, Israeli-controlled crossings.

The Palestinians want immediate control of the crossing into Egypt. They say the free flow of people and goods across the border is essential for rebuilding Gaza's shattered economy, and without free movement, Gaza effectively remains under Israeli occupation.

Palestinian workers were busy renovating the terminal area Sunday, bringing in x-ray machines and other technical equipment in hopes of reopening the crossing.

Palestinian Communications Minister Sabri Saidam said the Palestinians will not accept the alternate crossings, and have turned to Egypt to work out a deal. But he said the Palestinians will not try to open the crossing without an agreement.

"At the end of the day there will be coordination with Israelis in terms of operation," he said.