GAZA CITY, Gaza Strip - Egypt opened its sealed border crossing with the Gaza Strip on Saturday, allowing hundreds of people to enter and leave the coastal territory in a goodwill gesture before the holy Muslim month of Ramadan begins, officials said.

Palestinians who live abroad or are seeking medical treatment and Egyptians stuck in Gaza because of the sealed border gathered at dawn in a nearby sporting centre, where Hamas police shipped them to the Rafah crossing in buses.

On the Egyptian side of the border, hundreds of Palestinians massed to cross back into Gaza after being shut out for months.

"I am going back home," said Umm Usama, an Egyptian woman married to a Palestinian man, who came to Gaza to visit relatives. "Thank you, President Mubarak, for letting us return home before Ramadan," which begins early next week.

Rafah was sealed after the militant Muslim Hamas group seized power in Gaza in June 2007, confining 1.5 million Gaza residents to the tiny coastal territory. Egyptian officials have infrequently opened the crossing since, though in January, Hamas gunmen breached the border, allowing hundreds of thousands of Palestinians and Egyptians to cross back and forth before Egypt clamped it shut again.

Israel also has sealed its crossings with Gaza, only allowing in humanitarian aid and a trickle of commercial goods.

One Gaza resident who has lived in Saudi Arabia for 23 years said he came to visit his dying mother before the Hamas takeover and ended up stuck in the territory for 20 months.

Hamas' interior ministry, eager to demonstrate its ability to control security on the Gaza side of the crossing, did not allow residents to approach the southern passageway on Saturday morning. Palestinians have traditionally stormed the border when it has been pried open, chaotically jostling to get to the top of lines to leave Gaza.

People eligible to enter Egypt were told to gather at dawn in the southern Gaza town of Khan Younis, where their applications were processed. Buses crossed through to the Egyptian side where hundreds of police crowded to ensure security.

Some 1,000 residents left to Egypt by Saturday afternoon and an additional 500 Palestinians entered Gaza from Egypt, according to Gaza's Hamas interior ministry.

"We thank (Egyptian) President Hosni Mubarak for opening the crossing today, and we hope the opening days will be extended," said Hamas' prime minister in Gaza, Ismail Haniyeh, in a statement to the media.

Salam Fayyad, prime minister of the internationally recognized Palestinian government that rules the West Bank, also called on Egypt to keep the crossing open.

Over Saturday and Sunday, Egypt will allow Palestinian students enrolled in universities abroad to leave Gaza, along with those with foreign residencies and work visas. Numbers were not immediately available.

Around 300 Egyptians were stuck in Gaza after they entered the territory following Hamas' border breach. Some 400 Palestinians needing medical treatment also will head to Egypt on Sunday, officials said.